Perhaps you could loop through the 256 entries in the pallette, and confirm
that each entry corresponds with a grey level? For example, when I create an
8bpp greyscale image, I build the palette entries as follows:
<code>
Bitmap tmp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed);
ColorPalette greyPal = tmp.Palette;
for(int i = 0;i<greyPal.Entries.Length;i++)
greyPal.Entries[i] = Color.FromArgb(i,i,i);
</code>
Not sure if the above method of building palette entries is a strict
definition of grayscale...
Norvin
"Andrew" <andrew@postmet.com> wrote in message
news:ecHBR3P6EHA.1120@TK2MSFTNGP11.phx.gbl...
> Hello.
>
> How to determine that a loaded Bitmap is grayscale ?
>
> I am loading a grayscale JPEG using System.Drawing.Bitmap.FromFile() and
> PixelFormat property is Format8bppIndexed. It's strange to me, that
> there is no something like Format8bppGrayScale in GDI+ (there is only
> Format16bppGrayScale, which not likely to use for me). So, GDI+ creates
> a table with 256 entries with colors from black to white. But, loading,
> for example, GIF gives the same result - Format8bppIndexed. So, how to
> determine, that I was loaded a grayscale image ? I was trying to use
> Bitmap.Palette.Flags property, to determine, because MSDN says, that
> "0x00000002 - the colors in the array are grayscale values". But the
> flag is equal to zero.
>
> Andrew