When I do
FREE_IMAGE_TYPE fit = FreeImage_GetImageType(fib);
I get back FIT_RGB16. From the documentation, it says FIT_RGB16 should be treated as unsigned short. This doesn't make sense because EXR has 32 bits per channel.
Isn't it supposed to return FIT_RGBF?
The files I used are https://github.com/nickrasmussen/openexr-orig/tree/master/OpenEXR-images/TestImages
Hi. EXR files support 16-bit floating-point, 32-bit floating-point, and 32-bit integer per channel formats. (See http://www.openexr.com/)
The README for the GitHub page you linked explicitly reports some images as 16-bit, e.g. "AllHalfValues.exr - The pixels in this RGB HALF image contain all 65,536 possible 16-bit floating-point numbers, including positive and negative numbers, normalized and denormalized numbers, zero, NaNs, positive infinity and negative infinity."
From what I can understand in your reply, FREE_IMAGE_TYPE::FIT_RGB16 can either be a 16-bit floating point value (half) or an unsigned 16-bit short?
How would I query when it's a half versus a short? I can only find in the doc how to get BPP, RGB Mask and FREE_IMAGE_COLOR_TYPE.
Thank you for the prompt reply.
Hi Phi. Sorry, I'm just another FreeImage user, so my understanding is limited - I just thought I'd add my $0.02 since no one else had commented!
For the test image "AllHalfValues.exr", I get a FREE_IMAGE_TYPE of FIT_RGBF (96-bit RGB float image), and just to double-check that, FreeImage_GetBPP also returns 96.
For the test image "WideFloatRange.exr", I get a FREE_IMAGE_TYPE of FIT_FLOAT (single array of 32-bit floating point) and a FreeImage_GetBPP result of 32.
Are these the same values you receive?
In my opinion, those are the correct types for FreeImage to return (since it doesn't have a 16-bit floating-point data type). Presumably FreeImage has transparently converted the 16-bit floating point values to standard 32-bit ones.
Unfortunately, I can't easily test if the returned image is accurate. FreeImage can only convert FIT_RGBF images to 24/32bpp (for screen display) via tone-mapping, which is great for photos but not very helpful for test images like this. When applying tone-mapping to the test images, I simply end up with a completely black image for "AllHalfValues.exr", and a completely white image for "WideFloatRange.exr".
A simpler linear transform could be done to compare the output to something like Irfanview (which can read EXR files), but you'd have to do it manually, per this forum post: https://sourceforge.net/p/freeimage/discussion/36110/thread/4fd23e85
No problem. Thank you for the sanity check. It was a semantic error I got w.r.t. FIT_RGB16; everything matches now.
The reason for wanting the 16-bit floating point (half) is that it's supported in OpenGL :)
I was hoping FreeImage would keep the format unchanged, but this is good to know nonetheless.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.