AVIF, JPEG XL, JPG HDR gain maps and other HDR import/export settings

Hier diskutieren die Betatester von PhotoLine untereinander und mit den Entwicklern
Benutzeravatar
shijan
Mitglied
Beiträge: 2033
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

AVIF, JPEG XL, JPG HDR gain maps and other HDR import/export settings

Beitrag von shijan »

I tested some non tone mapped film scans on 400 nit (measured as 328 nit) and 3000:1 (measured as 2500:1) contrast ratio (11.3 stops of dynamic range) display and i really like that look. I use legacy macOS version that can't communicate and toggle display to real HDR mode for movies and still images, so i don't switch display to HDR mode and don't use any special HDR profiles for this. Film negative scans itself natively holds 10-12 stops of dynamic range and perfectly fits into display dynamic range without any special tone mapping even if use ICC profile with simple sRGB tone curve. The problem i guess, if i share those non-tonemapped photos online, they will look correct only for those who will watch photos on monitor with same contrast ratio and same 400 nit brightness setting.

HDR for images is rather new tech and still learn about it. From my understanding there are some special formats exists like AVIF JPEG XL and also in some new specification of JPG with HDR gain map that allow to share and see HDR images in modern web browsers. AVIF can keep HDR settings as special metadata or as ICC profile. It is all similar to HDR movies when display automatically switches to HDR mode (max brightness and PQ tone curve) and image viewer reads metadata of display brightness and adjusts image dynamic range depending of that max display brightness.

:?: The main question is how to get that HDR metadata when edit images and how to export it with image? Is it a part of AVIF JPEG XL and JPEG encoder/decoder specification? Is it some special tone curve in ICC profile? Or both?

:arrow: So i guess it could be nice to have support for all those modern image HDR options in PhotoLine.

Here is also similar request and JPEG with gain map test image that i find in other forum. (by the way, PhotoLine at least can read that test multilayered JPEG):
"The best way to export share HDR is via a "gain map", which allows the image to adapt to any display (regardless of level of HDR support). A JPG with a gain map is the ideal way to do that now (and AVIF with a gain map will be important in the next year).
And the native way that HDR images are captured on iPhone or Android now is via JPG or HEIC encoded with a gain map.
The priority is encode / decode support for JPG and decode support for HEIC (at least under the ISO gain map spec). This would allow support for smart phone captures and sharing any edited images. Support to decode other XMP gain map encodings would be nice for legacy support, but phones are already capturing with ISO encoding and this is not as critical. It would ultimately be ideal to have support for AVIF gain maps, as that will become an important standard in the near future.
Attached is a test image which should show blue HDR text when opened with proper HDR support. If the display supports 4 stops of HDR headroom, the text will be clear. If it less headroom, it will show the blue HDR very faintly (this is a good and expected result based on how the image is encoded).

And also some info from Google:
"A JPEG gain map is a technology that embeds extra brightness/color data (an HDR version) and instructions (the "gain map" itself) within a standard JPEG file, allowing it to display beautifully on both basic SDR screens (as a normal image) and advanced HDR displays (with enhanced brightness and color) using a single file, ensuring compatibility while unlocking true High Dynamic Range. It works by having a default SDR image plus a secondary map that tells compatible software how much to "gain" (brighten/adjust) each pixel for HDR, solving the old problem of sharing HDR content across different screen types."

Bild
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
shijan
Mitglied
Beiträge: 2033
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: AVIF, JPEG XL, JPG HDR gain maps and other HDR import/export settings

Beitrag von shijan »

I also find this macOS 15.0+ tool for converting HDR files to Adaptive (Gain Map) HDR / ISO HDR.https://github.com/chemharuka/toGainMapHDR

And also AI Overview:
A JPEG HDR Gain Map embeds an SDR (Standard Dynamic Range) base image with a separate "gain map" layer and metadata, allowing the file to display beautifully on old screens (as the base SDR) or adaptively render stunning HDR on modern HDR displays, ensuring consistent artistic intent across devices without relying on inconsistent browser tone mapping. It's a clever way to get true HDR benefits in the widely-supported JPEG format, leveraging modern display capabilities while maintaining backward compatibility, with support growing in browsers (Chrome, Edge, Safari) and operating systems (Apple, Android). 

How it Works
• Base Image: A standard, fully compatible SDR JPEG image that any device can display.
• Gain Map: A secondary, hidden image (often log-encoded) that contains instructions for how to brighten specific pixels to create the HDR effect.
• Metadata: Tells the display software how to interpret the gain map and the maximum brightness the display can handle.
• At Display Time: A compatible browser/device uses the gain map to scale the base SDR image up to HDR when on an HDR screen, or just shows the SDR image on an SDR screen. 

Key Benefits
• Universal Compatibility: Works everywhere; unsupported devices just see the great SDR image.
• Artistic Control: Prevents undesirable automatic tone mapping, giving creators control over the SDR and HDR versions.
• Efficiency: Combines HDR and SDR data into a single, compact file. 

Support & Usage
• Standardized: Part of the ISO 21496-1 standard.
• Growing Support: Implemented in Chrome, Edge, Opera, Safari (macOS/iOS), and Android.
• Common Use: Apple devices (iPhones, Macs) have supported this for years, capturing HDR photos as JPEG + Gain Map. 
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302