Please dont quote this How can I check the color depth of a Bitmap? or How to check if a picture is in grayScale
Because an image can be 24/32 bit per pixel even if
Ok you need to take the RGB components of a bit sequence. Lets say the sequence is 24 bits so you have the following bit sequence:
RRRRRRRRGGGGGGGGBBBBBBBB
WhereR
is a bit for red
, G
is a bit for green
and B
is a bit for blue. To separate this you can do it with bitwise operators.
color = Bitmap.GetPixel(iCounter, iCount).ToArgb();
blue = color & 0xFF; // Get the 1st 8 bits
green = (color >> 8) & 0xFF; // Remove the 1st 8 bits and take the 2n 8 bits
red = (color >> 16) & 0xFF; // Remove the 1st 16 bits and take the 3rd 8 bits