13thsymphony / HDRImageViewer

UWP app to view high dynamic range (HDR) and wide color gamut (WCG) images.
https://13thsymphony.github.io/
MIT License
76 stars 21 forks source link

Not recognizing RGBE image color space. #54

Open jbondhus opened 1 year ago

jbondhus commented 1 year ago

I've converted an image with ImageMagick from TIF in the ProPhoto RGB space to a .hdr file with primaries set to match this color space. Despite this, the color profile is clearly being interpreted as sRGB in this viewer.

See tiff and hdr file here.

https://jbondhus-sharing.s3.us-east-1.amazonaws.com/2022/2022-11-30/attachment.7z

See below for a comparison between the original TIFF and what the HDR image viewer shows of the .HDR file I generated.

_1001695

The file header is as follows in plain text, which looks correct to me - primaries of ProPhotoRGB...

#?RADIANCE
EXPOSURE=0.1
GAMMA=1
PRIMARIES=0.734699 0.265301 0.159597 0.840403 0.036598 0.000105 0.345704 0.35854
FORMAT=32-bit_rle_rgbe
jbondhus commented 1 year ago

I've opened a discussion about this with ImageMagick as well, here it is for some additional context. At first we thought it might be a problem with how I was using ImageMagick, but it seems more and more likely that it's a problem with the viewer.

https://github.com/ImageMagick/ImageMagick/discussions/5823

13thsymphony commented 1 year ago

Thanks for your patience and for reporting this.

I am relying on DirectXTex for RGBE decoding, and it appears that it does not implement reading PRIMARIES metadata: https://github.com/microsoft/DirectXTex/blob/main/DirectXTex/DirectXTexHDR.cpp

51 is also related to RGBE header decoding - potential resolutions are to ask for this functionality to be added to DirectXTex, add my own custom header processing, or find a different decoder library.