Problem with Format24bppRgb and non-BMP images.

  • Thread starter Thread starter Fernando Cacciola
  • Start date Start date
F

Fernando Cacciola

Consider: (C#)

Bitmap lBmp1 = (Bitmap)Bitmap.FromFile(<some file>, true);

Bitmap lBmp2 = lBmp1.Clone(<source rectangle>, PixelFormat.Format24bppRgb )
;

lBmp2.LockBits(<some rectange>,
ImageLockMode.ReadWrite,
PixelFormat.Format24bppRgb
) ;

With some images, such as an 8bpp GIF, the LockBits method raises an
"InvalidParameter" exception.

I know the source image is not 24bits, but I Cloned it expectig the
PixelFormat parameter to do the conversion.

Is there any other way to convert an arbitrary image into 24bits RGB?

TIA

Fernando Cacciola
SciSoft
 
Back
Top