I have a 8 bit bitmap color image. when i do a
Color pixelcolor = b.GetPixel(j,i);
Console.Write(pixelcolor.ToString() + " " );
I get
Color [A=255, R=255, G=255, B=255]
I need to get only the 8 bit value. not 24 bit seperate values for R,G,B ,A.
There is no way to do this using the
Bitmapclass directly. However, you can use theLockBitsmethod to access the pixels directly.Using unsafe code: (remember to enable unsafe code in your project first)
The safe alternative, using
Marshal.Copy: