سؤال

I'm trying to use the FreeImage.Net library to open the image and convert it to a standard bitmap, but either there must be a step I'm missing, or FreeImage simply can not convert floating point RGBA to 32BPP RGBA:

FreeImageBitmap fib = new FreeImageBitmap("C:\\test.exr");
Console.WriteLine(fib.ImageType); //FIT_RGBAF   
fib.ConvertType(FREE_IMAGE_TYPE.FIT_BITMAP, true); //returns False

Conversion fails:

Can not convert from type 12 to type 1; No such conversion exists.

I need this as a 32BPP RGBA Bitmap solely for the purpose of being able to convert it into a System.Drawing.Bitmap, so I may draw it using GDI+. I'm willing to use a different image library if necessary, or to consider WPF over Winforms if anyone thinks a solution will be found there.

I've uploaded an example floating point EXR for testing: http://dl.dropbox.com/u/2817180/test.exr

هل كانت مفيدة؟

المحلول

AS Niko said, you should do it manually. Using unsafe code, and pointers that would PIN your memory buffers and make it unmovable, your routine will be both fast in execution and easy to write.

More so if you are having just one source and one target format.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top