UtilImageGetPixelColorPercentOfImage(Image, Int32, Color) Method
Analyzes each pixel of the spcified image, counts all the pixels that are of same color as the color specified,
then calculates a percentage of the total grayscale presence in the image.
Namespace: DevCase.Core.Media.GraphicsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static double GetPixelColorPercentOfImage(
Image img,
int dimensionIndex,
Color color
)
Public Shared Function GetPixelColorPercentOfImage (
img As Image,
dimensionIndex As Integer,
color As Color
) As Double
Dim img As Image
Dim dimensionIndex As Integer
Dim color As Color
Dim returnValue As Double
returnValue = UtilImage.GetPixelColorPercentOfImage(img,
dimensionIndex, color)
public:
static double GetPixelColorPercentOfImage(
Image^ img,
int dimensionIndex,
Color color
)
static member GetPixelColorPercentOfImage :
img : Image *
dimensionIndex : int *
color : Color -> float
No code example is currently available or this language may not be supported.
- img Image
-
The source image.
- dimensionIndex Int32
-
The index of the image dimension to analyze.
- color Color
-
The color.
Double
The resulting percentage of pixels in the source image that are of same color as the color specified.
This is a code example.
No code example is currently available or this language may not be supported.
Dim color As Color = Color.FromArgb(255, 255, 255, 255)
For Each file As FileInfo In New DirectoryInfo("C:\Images").EnumerateFiles("*.gif", SearchOption.TopDirectoryOnly)
Using img As Image = Image.FromFile(file.FullName)
Dim percent As Double = GetGrayScalePixelPercentOfImage(img, dimensionIndex:=0, color:=color)
Dim strFormat As String = String.Format("[{0,6:F2} %]: {1}", percent, file.Name)
Console.WriteLine(strFormat)
End Using
Next file
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.