Jump to content
You must now use your email address to sign in [click for more info] ×

Making a panorama from HEIC files and keep HDR data


Recommended Posts

Hello everyone,

First of all, sorry if this has been asked before. I did search the forums before creating a topic, but could not find anything.

I've tried using Affinity Photo to make panoramas out of pictures I took with my iPhone, and the tool's been great to use. However, as far as I can tell, HDR data is getting lost in the process. I'm doing the following:

- Export the original files (.HEIC) from iPhoto
- Create a new panorama from those HEIC files
- Export the created panorama as an HDR file

However, when importing the file back to the iPhone the HDR data is lost.

What am I doing wrong? And a "bonus" question: is there any way to export directly to HEIC? (HDR files are massive in comparison)

Link to comment
Share on other sites

  • Staff

Hi jp.ptn,

When you create a panorama, the output should retain it's colour profile in your case likely RGBA/8 P3. (this format uses the entire gamut of P3, but at 8 bit resolution)

You can export RAW from your iPhone if you wish to retain the full colour information from your iPhone.

https://support.apple.com/en-gb/HT211965]

When exporting what format and colour profile are you exporting as?

Lee

 

 

Link to comment
Share on other sites

3 hours ago, Lee_T said:

Hi jp.ptn,

When you create a panorama, the output should retain it's colour profile in your case likely RGBA/8 P3. (this format uses the entire gamut of P3, but at 8 bit resolution)

You can export RAW from your iPhone if you wish to retain the full colour information from your iPhone.

https://support.apple.com/en-gb/HT211965]

When exporting what format and colour profile are you exporting as?

Lee

 

 

Thank you for your reply.

I'm exporting what I assume are the .heic files (from Photos, File > Export > Export Unmodified Original). The originals, when watched on the iPhone, are clearly HDR. The panorama made with Affinity Photo doesn't have the highlights that the originals have, so I assumed that the HDR data was being lost in the process.

I created a simple example: took some pictures pointing at light sources, then I exported them from Photos like I described above. On Affinity Photo I ran File > New Panorama…, selected the .heic files, clicked "Stitch panorama" and "apply", or whatever the default actions are, then saved the result both as an Affinity Photo file and an .hdr file. On my M1 Max MBP there's a clear difference in brightness between the original in Photos and the panorama in AP.

By the way, it's unrelated to this topic but .hdr files created with AP not always display correctly on mac OS. I've had some work, but most show just black. I don't know if this is an AP issue or mac OS issue, since I've only ever worked with .hdr files trying to make these panoramas, but I thought it'd be worth mentioning.

Thanks in advance!

Edited by jp.ptn
Removed file
Link to comment
Share on other sites

  • Staff

Your images are 8 bit (RGBA/8 P3), as noted at the top left hand corner.

Rather confusingly, .HDR is known as .HDR Radiance format and is not a general use file format. It's typically used in the 3D/movie industries. (Mac OS does not have support for .HDR radiance files by default and you will notice Finder will show a black thumbnail and preview)

I would advise exporting in a format such as PNG/TIFF using the p3 colour profile. If you wish to get the full dynamic range, you will need to export from your phone as RAW, then process in the same way.

Lee

 

image.png

Link to comment
Share on other sites

21 minutes ago, Lee_T said:

Your images are 8 bit (RGBA/8 P3), as noted at the top left hand corner.

Rather confusingly, .HDR is known as .HDR Radiance format and is not a general use file format. It's typically used in the 3D/movie industries. (Mac OS does not have support for .HDR radiance files by default and you will notice Finder will show a black thumbnail and preview)

I would advise exporting in a format such as PNG/TIFF using the p3 colour profile. If you wish to get the full dynamic range, you will need to export from your phone as RAW, then process in the same way.

Lee

 

image.png

First of all, thank you for clarification on the HDR format, I'll steer clear from it from now on, since it's not intended for the purpose I meant.

However, my iPhone doesn't support capturing photos in ProRAW, therefore I can't export them as RAW. I'm at a loss now, because when I use Photos and export what is supposedly their unmodified original, it seems that the HDR data is lost / the color profile changes / something I don't quite understand happens. So the actual issue is happening before even opening AP

I suppose you don't have any suggestions on how to import the photos in their HDR color profile to AP… Thank you anyway, for helping me figure out what was going on. Sorry for wasting your time with something unrelated to AP. Best regards!

Link to comment
Share on other sites

Wait, this is confusing for me…

A photo, when viewed in the Photos app, is HDR. If I export it as an unmodified original, and open it with the Files app, it doesn't display as HDR. However, if I import that same file to Photos again, then it shows up as HDR as it was initially.

So the .heic file has HDR data after all? I don't understand anything anymore.

Link to comment
Share on other sites

  • Staff

In essence the images you sent are both HDR in one sense, but not in another.

As I mentioned, it's a complex subject, but if you wish to try and understand, the information below may help. 

If you wish for the short version, basically, the images you have can display quite brightly/vibrantly, but don't contain a huge amount of detail in-between.

Now, I've tried to simplify it a little bit but I understand it's still a complex subject so feel free to ignore!

______________________

The images taken on your phone camera are 8 bit, therefore there are 16.78 million possible tones per pixel. (256×256×256)

Bit Depth, Bits Per Pixel, High/True Colour & Monochrome – Unit 35 Digital  Graphics

This for example means that a pixel that is 100% red would be R255 G000 B000 with 255 being the maximum it could be, and a small range of values until it fades from red to fully black (R000, G000, B000).

If this were a 10 bit image, 100% red would still look like the same colour, except instead of values 0-255, it could be represented smoother with 1024 values from black to red allowing for more nuance/detail and less noticeable banding as it changes from value to value.

 

The Deep Dive on Bit Depth

 

Regarding Colour profiles:

P3 is far has a far wider colour profile than sRGB, the most common display type. The colour profile relates to how red that red is. An sRGB image on an SRGB screen for example that red will look fine, but a pure red on a P3 image will look far more vibrant on a screen compatible with the P3 profile, but will look incorrect on a display that isn't. 

The dynamic range (SDR/HDR) refers to the range of either colour or brightness/darkness of each pixel.

The reason this is important to understand is that whilst your images are 8bit and contain a maximum 256 values from fully black to fully red, that red is very vibrant.

 

You'll have likely seen images like this before:

What are color profiles? And why do they matter? · Sketch

 

This shows you that the corners of the triangle for P3 are much more vibrant than their sRGB equivalent. 

Lee

 

Link to comment
Share on other sites

12 minutes ago, Lee_T said:

In essence the images you sent are both HDR in one sense, but not in another.

As I mentioned, it's a complex subject, but if you wish to try and understand, the information below may help. 

If you wish for the short version, basically, the images you have can display quite brightly/vibrantly, but don't contain a huge amount of detail in-between.

Now, I've tried to simplify it a little bit but I understand it's still a complex subject so feel free to ignore!

______________________

The images taken on your phone camera are 8 bit, therefore there are 16.78 million possible tones per pixel. (256×256×256)

Bit Depth, Bits Per Pixel, High/True Colour & Monochrome – Unit 35 Digital  Graphics

This for example means that a pixel that is 100% red would be R255 G000 B000 with 255 being the maximum it could be, and a small range of values until it fades from red to fully black (R000, G000, B000).

If this were a 10 bit image, 100% red would still look like the same colour, except instead of values 0-255, it could be represented smoother with 1024 values from black to red allowing for more nuance/detail and less noticeable banding as it changes from value to value.

 

The Deep Dive on Bit Depth

 

Regarding Colour profiles:

P3 is far has a far wider colour profile than sRGB, the most common display type. The colour profile relates to how red that red is. An sRGB image on an SRGB screen for example that red will look fine, but a pure red on a P3 image will look far more vibrant on a screen compatible with the P3 profile, but will look incorrect on a display that isn't. 

The dynamic range (SDR/HDR) refers to the range of either colour or brightness/darkness of each pixel.

The reason this is important to understand is that whilst your images are 8bit and contain a maximum 256 values from fully black to fully red, that red is very vibrant.

 

You'll have likely seen images like this before:

What are color profiles? And why do they matter? · Sketch

 

This shows you that the corners of the triangle for P3 are much more vibrant than their sRGB equivalent. 

Lee

 

I understand the difference between 8 and 10-bit, for example, but I didn't – and still don't quite – understand how a photo's HDR colors were stored, and/or why the color range would be more pronounced in some situations than in others.

So non-RAW photos taken with a modern iPhone (like the .heic files I had posted) are just standard RGBA/8 P3, and the Photos app just uses some trick to display the data in a more vibrant way, depending on some flag? In other words, if I open a .heic file with AP and export it as a RGBA/8 P3 PNG, the actual picture is equivalent and the difference in perceived vibrancy is due to how the data is displayed, and not the actual data?

Thank you again for your patience!

Link to comment
Share on other sites

@Lee_T

Well, what a rabbit hole I got into…

First of all, .heic files have a HDR gain map after all. Here's a tool that converts them to regular HDR photos:

https://pythonawesome.com/convert-hdr-photos-taken-by-iphone-12-or-later-to-regular-hdr-images/

Quote

 

The HDR gain map is encoded in the HEIF file as an auxiliary image (auxC). Both the main image and the HDR gain map is encoded in 8-bits precision. If the image viewer doesn’t support this format, it will only show the main SDR image, effectively becoming a tone mapping mechanism.

The exact algorithm is not disclosed, even the Photos app on iPhone and Mac renders differently. Therefore, I assume there is no clear documentation even inside Apple, Inc. The following is a rough guess of how it works:

To render the HDR version of the image, we need to multiply the SDR luminance with “a constant raised to the power of the gain value”. If the gain value is 0.0, the image is unchanged. If the gain value is 1.0 (actually 255), the luminance is multiplied by that constant.

I choose the constant to be 7.5 because it looks good, and it matches scRGB.

 

Second, an EXIF tag seems to be controlling whether the gain map shows any effect or not:

https://gist.github.com/kiding/fa4876ab4ddc797e3f18c71b3c2eeb3a?permalink_comment_id=4289203#gistcomment-4289203

So for AP to make panoramas while keeping the photos' HDR gain maps it would have to both include the maps on the panorama, and set the EXIF tag for it to have an effect. I assume, then, that AP doesn't support HDR gain maps on .heic files, therefore they're lost when making a panorama, is that correct?

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.