The following code is used to create a 8 bit bitmap
Bitmap b = new Bitmap(columns, rows, PixelFormat.Format8bppIndexed);
BitmapData bmd = b.LockBits(new Rectangle(0, 0, columns, rows), ImageLockMode.ReadWrite, b.PixelFormat);
But when i save it it is saved as a 8 bit color bitmap. Is it possible to directly create a 8 bit grayscale bitmap without creating a 8 bit color bitmap and later having to convert it to a grayscale ?
If you have a bitmap that has a palette then there’s not really a notion of whether the bmp is greyscale or not. As long as all colours in the palette are greyscale then the bmp is.
This code should help (it’s VB but should be easy to translate):
Found here: http://social.msdn.microsoft.com/Forums/en-us/vblanguage/thread/500f7827-06cf-4646-a4a1-e075c16bbb38