ICC profile issues with HEIC file

Started by blue-j, January 14, 2022, 12:37:25 PM

Previous topic - Next topic

blue-j

This file is in RGB, Display P3 space, but Exiftool reports it as "Linear Gray."  My guess is that "Linear Gray" is the space of the depthmap.  Have a look-see?

I'm using 12.39 on macOS.

- J

Phil Harvey

This file has 2 ICC profiles:

> exiftool ~/Desktop/IMG_4411.HEIC -a -G1 -profiledescription
[ICC_Profile]   Profile Description             : Display P3
[ICC_Profile2]  Profile Description             : Linear Gray


I supppose ExifTool should give priority to the profile for the main image.  More work for me. :(

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

blue-j

Dang it!

Yes, the second profile is the profile for the depthmap image, almost certainly.

- J

rcsumner

#3
Hi, I am running into this issue as well. Is there any way incorporated in the tool yet to specify to defaulting to extracting the RGB one?

In the meantime, I think I can write some wrapper code to check if what is pulled out by default is Linear Gray or not and check for another Group's version to pull out, similar to what I found at https://exiftool.org/forum/index.php?topic=3691.0

Thanks!
-R

Phil Harvey

I've spent a couple of hours on this and I think I can set things straight in version 12.65.  If all goes well you should be able to get the profile for the primary image with this command:

exiftool -main:icc_profile FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Darn.  My patch doesn't work for some other Apple HEIC files.  Apple is inconsistent on whether or not the ICC profile refers to the primary image object.  Here is a dump of relevant properties from your sample where the primary image is object 49 and it has properties 1, 4, 5 and 6.  (Property 1 is the ICC profile.)  Note that the compressed hvc1 data also has property 1.

IMG_4411.HEIC (iPhone 12 Pro 15.1.1)

Primary Item Reference: 49
  | |   Item 1: Type=hvc1 Name= ContentType=
  | |   Item 49: Type=grid Name= ContentType=
  | |   Item 49 refers to: 1-48
  | |   Item 1 properties: 3 1 2
  | |   Item 49 properties: 1 4 5 6

Properties:
  | | 1)  ICC_Profile (SubDirectory) -->
  | | 2)  HEVCConfiguration (SubDirectory) -->
  | | 3)  ImageSpatialExtent = ..
  | | 4)  ImageSpatialExtent = ....
  | | 5)  Rotation = 3
  | | 6)  ImagePixelDepth = ....

But unfortunately for some other samples like this one, the primary image doesn't have the ICC profile as a property:

../pics/Apple_iPadPro10.5inch.heic (11.0)

Primary Item Reference: 49
  | |   Item 1: Type=hvc1 Name= ContentType=
  | |   Item 49: Type=grid Name= ContentType=
  | |   Item 49 refers to: 1-48
  | |   Item 1 properties: 3 1 2
  | |   Item 49 properties: 4 5 6

Properties:
  | | 1)  ICC_Profile (SubDirectory) -->
  | | 2)  HEVCConfiguration (SubDirectory) -->
  | | 3)  ImageSpatialExtent = ..
  | | 4)  ImageSpatialExtent = ....
  | | 5)  Rotation = 0
  | | 6)  ImagePixelDepth = ....

...although the hvc1 data does have the profile as a property.  So I have to figure out a way to also accept the properties of the primary image hvc1 data as properties of the main image.  Yet more time wasted on this.

- Phil

Edit: Plus, this impacts writing of HEIC files, so I have to be really careful about any changes in this area so I don't break the already-well-tested HEIC writing capabilities.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I've figured out a way to do this, and ExifTool 12.65 should fix this.  So far it is working for all the samples I have on hand.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

blue-j

Thanks so much, Phil!  The HEIF format increases the speed of my aging.  - J