Reputation: 79
string greenImage = @"C:\Users\keti.p\Desktop\greenImage.jpg";
Bitmap bitMap = new Bitmap(greenImage);
int width = maxWidth / 2;
int height = maxHeight / 2;
Color c = bitMap.GetPixel(width, height);
Color color = Color.FromArgb(c.R, c.G, c.B);
I have this "color" Object,
For example, is this color green? Or is it red? or? What a ranger in green..
Upvotes: 6
Views: 995
Reputation: 38757
You want to check the hue of the colour using the GetHue
HSL method of the Color
type:
Color a = Color.Red;
Console.WriteLine(a.GetHue()); // 0
Color b = Color.Green;
Console.WriteLine(b.GetHue()); // 120
I believe the numbers should correspond to this chart:
Upvotes: 9