Ah, now I get you.
If you have an 8bpp color bitmap to begin with. Simply convert the palette to grayscale.
ColorPalette pal = myBitmap.Palette;
for(int i = 0; i < pal.Entries.Length; i++)
{
Color c = pal.Entries[i];
int gray = (int)(c.R * 0.3086f + c.G * 0.6094f + c.B * 0.082f);
pal.Entries[i] = Color.FromArgb(255, gray, gray, gray);
}
myBitmap.Palette = pal;
[quoted text, click to view] On Fri, 27 May 2005 13:20:28 +0200, bert <nonja99@hotmail.com> wrote:
> Hi morten,
>
> I know there is no grayscale pixelformat. The bitmap is a 8bpp format
> wich is converted to grayscale using colormatrix.
> I'm trying to find a way to save this RGB bitmap as grayscale.
>
> The 16bppGrayscale pixalformat is indeed broken. It shouldn't be in
> the framework sourcecode but somebody left it in :-(
>
>
>
> On Fri, 27 May 2005 12:23:11 +0200, "Morten Wennevik"
> <MortenWennevik@hotmail.com> wrote:
>
>> Hi Bert,
>>
>> There is no 8bpp GrayScale pixelformat, only a 16bpp one and I'm not sure you can use that either as I think all the 16bpp formats are broken.
>
>
--
Happy coding!