Jump to content

Feature request: support for .HEIC files' HDR gain maps


Recommended Posts

I have an iPhone 13, which can take HDR photos but not in RAW format.

When I use the Panorama function in the built-in Camera app, the result is SDR and often distorted, so on my latest holidays I thought I'd take many photos planning to stitch them together afterwards somehow. I was happy to find AP has such a feature, and was quite happy with the results.

That is, until I imported the newly made panorama to my Photos app. It was SDR, which is IMO a significant reduction in quality and prevents me from replacing the multiple shots with the single panorama I wanted in the first place. Not knowing what the issue was, I posted on these forums trying to find out what was going on, if I was doing something wrong.

After some help from your staff and going down a rabbit hole that took me to discussions on Github and tools made with Python, I found out that 1) .HEIC files do have a HDR gain map encoded as an auxiliary image, and 2) an EXIF tag needs to be set for the gain map to display properly on Photos. And even though all of this was based on unofficial data, it seems that Apple is opening up on how to handle such HDR files, as shown in a WWDC video from this year.

Setting the EXIF tag is something I can rely on 3rd-party tools for, but there's nothing I can do to about the HDR gain maps outside AP; it has to support .HEIC HDR gain maps in order to make HDR panoramas from such photos. That feature alone would make AP a front-row companion to Photos to me.

Hope such support someday finds its way to AP.

Link to comment
Share on other sites

  • 2 weeks later...

I second this request. The documentation says "HEIF open 4 Includes depth map, loaded as second layer. Depth maps are upsampled." it should also say "HEIF open does not support the iphone gain maps that render the image in HDR" so we would all understand that for the moment the iphone HDR heic images cannot be properly opened with Afinity Photo 2.

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...
On 10/18/2024 at 10:29 AM, iGeo said:

Can you share some more details about the Exif tag that needs to be set for hdr? And how to go about it?

Apple Photos in iPhone supports HDR without HDR gain maps as well. For example, HEIC in 10-bit or AVIF in 10- or 12-bit.

However if you already have a (inverse) tone-mapped HDR image as: an SDR image and a corresponding single-channel HDR gain map, you might be able to create an HEIC file that could work with Apple Photos by reverse engineering this article (roughly following these steps, which I haven't tried myself):

  1. Create a new "gain map" with appropriately chosen values for "maker33" and "maker48" that makes the script in the article above produce the original HDR gain map.
  2. Create a new HEIF file with the SDR image as the primary image and the above gain map (in an 8-bit greyscale form with half the resolution as the primary SDR image) stored as an auxiliary image with aux-type "urn:com:apple:photo:2020:aux:hdrgainmap" (https://github.com/strukturag/libheif can do that)
  3. Using exiftool, set the following tags:

Apple doesn't publish documentation to describe how an HEIC file with an HDR gain map can be created in a way that Apple supports it. So the above steps are just my guesses, and is definitely not reliable.

(Plug: If you want to convert an HDR HEIC file from your iPhone to a "normal" HDR file without gain maps, that could be read by AP, you can try this Python package that I made: https://github.com/johncf/apple-hdr-heic)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.