TomHL

TomHL

  • NA
  • 5
  • 0

Can't convert to Format8bppIndexed with LockBits, Why?

Aug 5 2005 7:41 PM

Hello,

I wrote a method to convert image's color table.

public class convert
{
    public static Bitmap bmp_convert(System.Drawing.Image pic)
    {
    
        Bitmap b = new Bitmap (pic);
        BitmapData bmData =b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format16bppArgb1555);
        b.UnlockBits(bmData);

        return b;
    }
}

unfortunately, I can't convert my image to Format8bppIndexed (or any indexed format) while to the other formats I can...(like: Format16bppArgb1555),why? and how can I fix it?