Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.92k stars 326 forks source link

Feature request: preserve the HDR gain map from jpg (Android and now apple ISO 21496-1) when saving as jpg #7236

Open hubertmeier opened 2 weeks ago

hubertmeier commented 2 weeks ago

after making HDR jpg from Android and Apple as an iso standard it would be nice, if RT could read the gain maps and store it when exporting as jpg.

for sure, if there are geometrical corrections the gain map has to be corrected to.

perhaps there should be at the beginning of the processing a conversion in an internal HDR format and at export the internal HDR has to be converted back ...

thank you

Lawrence37 commented 2 weeks ago

Can you provide a sample image?

Entropy512 commented 1 week ago

Doing this correctly would likely require the following: Apply the gainmap on import, linearize User does stuff Somehow determine new gainmap, save with https://github.com/google/libultrahdr

A benefit of splitting it up like this is that it supports a more common use case: User loads raw image User does stuff User wants to save UltraHDR image

I think editing the base JPEG layer while ignoring a static gainmap is a very bad idea.

A challenge here will be having a "consistent" SDR tonemap. I think libultrahdr does allow supplying your SDR image, but that's going to require significant changes to RT to do something like "HDR version is the image without certain modules applied" or "Use a different tone curve for HDR and SDR images" to the point where for a long time it'll be better for output to edit and save two images (HDR and SDR).

Applying the gainmap on import and not supporting UltraHDR export would likely be a much easier first step. I'll try and see if my Pixel spits out UHDR images now.

hubertmeier commented 6 days ago

Pixel 6 and later take photos with HDR gainmap. only my pixel 8 pro is capable to show the HDR version with Google Fotos. I use only modified GCAM Versions where the quality is much much better than with the original Google camera because i can control sharpening and noise. My workflow is to save the pictures with 100% JPG-Quality an no sharpening, i import them in RT, i apply moderate sharpening in RT and sometimes geometric corrections and export them again, that gives very good results. But the gain map is lost. I do not any color or exposure corrections, GCAM is nearly perfect.

In theory, stripping the gain map and re-apply at export could work, but geometric corrections and scaling must be applied to the gain map too...

is there still a need for samples?

Lawrence37 commented 6 days ago

No samples have been posted here yet, so yes. Samples are still needed.

hubertmeier commented 4 days ago

OK, here are some first samples made with a Pixel 6 pro. Software: original Google Camera 9.6. The pixel 6 pro can not show the HDR with google fotos, but the pictures are recorded with gain map. Actually there is no sun and i will repeat all pctures with better HDR effect with the pixel 8 pro, with standard google camera 9.6 and with modified GCAM 9.2 (AGC), in 12 and 50 mpix. And i will provide my profile for the conversion of the 50Mpix to 27,5 Mpix with sharpening, that gives really good results with absolut no overprocessed look. These samples here work, but HDR with real sun is much better.

PXL_20241114_142624680 PXL_20241114_142614255 PXL_20241114_135912947 PXL_20241114_135934481