bvibber / hdrfix

tool for converting HDR screenshots to SDR with suitable tone-mapping
114 stars 10 forks source link

Requesting insights for an equivalent workflow in ffmpeg/imagemagick #16

Open mmshivesh opened 4 months ago

mmshivesh commented 4 months ago

Hi,

I've independently been bashing my head against this problem (though my problem is probably related more to converting a .JXR to a .HEIC/.HEIF image with proper exposure while maintaining the HDR metadata) for a couple of weeks now.

I wanted to see if you had any suggestions about how a ffmpeg (or image-magick) command for performing the same conversion from ".jxr" to ".png". This would also help me automate it on my NAS to auto-convert all JXR screenshots into tonemapped PNGs/JPGs to save space. Maybe this would give me some insights into the workflow that could potentially work for HEIC images.

I've been looking through the code to reverse-engineer the workflow but my expertise doesn't lie in Rust unfortunately.

Thanks for your time!

bvibber commented 4 months ago

ImageMagick does not seem to handle HDR correctly, and ffmpeg doesn't read JXR, so unfortunately you'll need an additional tool to either do the conversion or convert the JXR to something else you can read with those tools.

Note I'm planning to add HDR AVIF output support in the future, but haven't gotten to it yet and have no schedule for the work. I don't plan to work with HEIC directly due to licensing issues with the HEVC codec.

mmshivesh commented 4 months ago

Note I'm planning to add HDR AVIF output support in the future, but haven't gotten to it yet and have no schedule for the work.

Yep, this would be amazing, just "theorycrafting" here, but would this approach potentially be an implementation that pairs a "gain map" with an SDR image?

ImageMagick does not seem to handle HDR correctly

Can definitely attest to this. Per their own admission, they have "less control over the workflow when we leverage delegate libraries and programs". There's something off about the output that it produces even when I take care to ensure that the parameters are 1:1, and it apparently is dependent on the underlying library defaults (?).

Thank you so much for your tool, it's helping me convert large swaths of my existing HDR screenshot library into PNGs (which I can further process into HEICs for smaller files).

Looking forward excitedly to your addition of HDR AVIFs which would additionally allow me to translate them into HEIF Gainmaps and retain the HDR metadata from the original image!

Please feel free to close this issue!