How do I make this into a grayscale?
After much googling it seems the best I can do is change the tint of the picture (in the code bellow, it’s a green tint). How can I do it?
byte[] redGreenBlueVal = new byte[numBytes];
for (int i = 0; i < redGreenBlueVal .Length; i += 4)
{
redGreenBlueVal [i + 0] = (byte)(.114 * redGreenBlueVal [i + 0]); --> blue
redGreenBlueVal [i + 1] = (byte)(.587 * redGreenBlueVal [i + 1]); --> green
redGreenBlueVal [i + 2] = (byte)(.299 * redGreenBlueVal [i + 2]); --> red
}
In effect you’re adjusting HSB so this should get you a better grayscale image:
30% RED
59% GREEN
11% BLUE