johannesvollmer / exrs

100% Safe Rust OpenEXR file library
Other
149 stars 23 forks source link

Convert exr to png file #218

Open Youdiie opened 1 year ago

Youdiie commented 1 year ago

I wanted to convert exr file to png file. I used the example 1b_convert_exr_to_png, but the color of converted png file was quite different from original exr file. exr file: (can't upload exr file, so instead screenshot)

스크린샷 2023-08-08 오후 3 07 17

converted png file: render (4)

I found the comment does the image crate expect gamma corrected data? in tone_map function. Is that comment related to this problem? Any comment will be helpful!

johannesvollmer commented 1 year ago

Hi! Yes, this might be the problem. The exr format allows many color spaces, in linear format. Most other software doesn't use linear colors.

Where do your exr images come from?

johannesvollmer commented 1 year ago

The color differences can have many sources, but I think these are the most likely in your case:

johannesvollmer commented 1 year ago

So essentially, remove the calculations from line 45 in the example

https://github.com/johannesvollmer/exrs/blob/0d78600022ed9f61f8b06414f56ca3301807b63b/examples/1b_convert_exr_to_png.rs#L45