resizing jpg (Format8bppIndexed)

Dec 1, 2010 at 3:18 PM

Hi - I kept getting this exception: "A Graphics object cannot be created from an image that has an indexed pixel format." when resizing a particular jpeg (other jpg's work).

So I changed NativeImageTool.cs Resize (approx line #44) from 

Bitmap bitmap = new Bitmap((int) newWidth, (int) newHeight, format);

to

Bitmap bitmap = new Bitmap((int) newWidth, (int) newHeight, PixelFormat.Format24bppRgb );

This appears to work ok... But I am not sure of the consequences. Any thoughts?

Thanks!

Developer
Jun 24, 2011 at 3:02 PM

Was the Jpeg actually a GIF with the wrong extension?