SFX.rar. Feb 12, 2018 09:12
Metin2 Client By Sandoz 94rar 15. Metin2 Client By Sandoz 94rar 15 Cracked
Metin2 Client By Sandoz 94rar 15: Metin2 Client By Sandoz 94rar 15 Data Download
SFX.rar. Feb 12, 2018 09:12
Metin2 Client By Sandoz 94rar 15.Q:
How to compare the color in a picture with a given hex value?
I need to check if the color in a picture is equal to a given color. For example, if I take a picture of blue color, then I need to check if the color of pixels in that picture is also blue.
How to compare the color in a picture with a given hex value?
A:
You could use a combination of
RGB values
int values
The following example will work in Windows only. If you're using Linux, there's probably something similar.
Image image = Image.FromFile("mypicture.png");
Color color = new Color(0, 0, 0);
Color c = image.GetPixel(x, y);
//Test if color is equal to new color
bool isEqual = (c.ToArgb().ToString() == color.ToArgb().ToString());
EDIT:
If the above doesn't work for you, you can try using RGB values. The ToArgb() method returns a type of object that's basically the same as the.Net Color type.
public bool IsColor(Color color, int value)
{
//Use RGB values for this example
Color toCompare = new Color(value, value, value);
//The RGB values we will use.
int r = color.R;
int g = color.G;
int b = color.B;
//The values we are comparing with.
int c = value;
// The value of 0, 0, 0 is white, so we're good if that's what you want.
if (r == c && g == c && b == c)
{
return true;
} be359ba680
Related links:
Comments