Add support for encoding JPG as ISO 21496-1
It appears the ISO gain map spec has progressed to draft international standard (https://www.iso.org/standard/86775.html), so I wanted to create a thread to facilitate discussion.
I believe the following will all be high value for libultra to support (ordered with most important first):
- encode to ISO JPG. This is most important for content creation and is of course a prerequisite for the next item (transcoding).
- transcode from supported gain map formats (Ultra HDR now, but ideally Apple too to support existing content from phone captures) to ISO JPG. For transcoding, as long as the image is not being mutated (cropping, etc), the output should be lossless (relative to the existing gain map). I presume all the metadata should map cleanly, and not recalculating the images is ideal for speed as well as quality.
- decode ISO JPG.
Adobe's gain map page now refers to the ISO spec and contains sample JPG images which appear to use it (per the optional info overlay in the updated demo app on that page). https://helpx.adobe.com/camera-raw/using/gain-map.html
I've added a sample ISO JPG here (currently listed as test 8a): https://gregbenzphotography.com/hdr/#tests
The latest ACR / LR updates from Adobe are able to export ISO gain maps for JPG, AVIF, and JXL.
@gregbenz setting this to true should resolve this request.
@ram-mohan Thanks!!
Are there plans to switch the flag on? Is this blocked on finalization of ISO 21496-1?
@koto android recommends writing both xmp and iso metadata. details here. We have added a pr #329 to take care of this. thank you.
Does Android use libultrahdr in camera app? Wondering why a photo taken from Android 15 has XMP but no ISO metadata.
While the adobe gain map sample JPEG is opposite, has ISO but no XMP.
Haven't found one JPEG with both XMP and ISO on internet 🤣
@mgenware A dual encoded image shows in the Adobe Gain Map Demo app as supporting ISO and does not mention there is valid XMP data (ie, it references the preferred data when both are present).
I have updated to latest Android 15 and Pixel camera as of today and do not see ISO encoding of the gain maps created with a Pixel 8 Pro, only the Android XMP encoding.
But it is encoded elsewhere. Latest Apple software dual encodes the Apple XMP + ISO. Latest Adobe LR / ACR dual encodes the Adobe XMP + ISO.
I can see both the Adobe XMP and ISO in the files I test. The tool you are using likely isn't reporting that both are present (which would be consistent with Adobe's gain map demo app). It would be nice if these tools listed any valid fallback metadata, but it seems they just report the primary supported encoding when both are available (ie, consistent with how a decoder should work if it understands the ISO encoding).
@gregbenz thanks for the info! I can confirm iOS 18 JPEG and HEIC are both dual encoded.
HEIC:
JPEG: