Tom94 / tev

High dynamic range (HDR) image viewer for graphics people
BSD 3-Clause "New" or "Revised" License
1.08k stars 86 forks source link

PNG with embedded color profile not displayed correctly #103

Open dvicini opened 4 years ago

dvicini commented 4 years ago

Hi,

I was trying to load a PNG image in TEV which was exported from GIMP. I did not create the image myself, but the person who created the image essentially loaded an EXR image in GIMP and exported it as a PNG with minor changes. The PNG displays correctly in Adobe Photoshop and Preview on MacOS, but not in TEV.

Upon closer inspection, I found that the PNG was stored in 16 bit with a custom color profile from GIMP. Reducing to 8 bit, but keeping the profile, does not change anything about the way TEV displays the image. If I convert the profile to a more standard RGB profile in Photoshop, TEV displays the image correctly.

So it seems that the problem is that TEV ignores custom color profiles in PNG files (?). I am not sure how easy it is to change that, but it would be good to at least have a warning being shown.

I have attached both an 8 bit and the original 16 bit version of the file.

test_images.zip

Best, Delio

Tom94 commented 4 years ago

Hi Delio, thanks for sharing + allowing for reproduction! This is a good issue to keep track of.

PNG decoding is unfortunately completely out of the hands of tev. tev uses stbi to open LDR images, including PNGs, and stbi doesn't support querying color profile information. See this issue on their end.

I'm hesitant to pull in heavier cannons than stbi to decode LDR images more correctly, since the primary purpose of tev remains operating on HDR data.

dvicini commented 4 years ago

Hi Thomas,

I knew that TEV was using an external library to load PNGs, but I wasn't aware that they don't even support color profiles! Let's hope someone replies to your comment on the other issue, such that we can at least have some kind of warning :)

Thanks for looking into it Delio

satoshiSchubert commented 5 months ago

Thank you so much for mentioning this problem and the tips on how to fix it with photoshop! After I used photoshop to open the problematic png file, photoshop prompted that there was a problem with the color profile. After conversion, it can be displayed normally in Tev after saving.