HEIC format changes

Started by wywh, February 05, 2025, 03:49:56 AM

Previous topic - Next topic

wywh

macOS High Sierra 10.13 was the first to support .heic images (and H.265/HEVC movies).

But macOS 10.13 does not seem to support the newest .heic flavors anymore. For example QuickLook and Preview.app do not open .heic shot with iPhone 12 mini and iPhone 16 Pro ("The file image.heic could not be opened. It may be damaged or use a file format that Preview doesn't recognize"). The next version macOS 10.14 Mojave opens those newer .heic images OK.

It seems the culprit might be a new QuickTime:ColorProfiles='nclx' and related tags that seem to be introduced in about iOS 18.0.1.

exiftool -a -G1 -s -fileOrder5 FileName -Software -Model -ColorProfiles .
======== ./2024-1022-1744-57.heic
[IFD0]          Software                        : 18.0.1
[IFD0]          Model                           : iPhone 16 Pro
[QuickTime]     ColorProfiles                   : nclx

Additionally newer .heic seem to have more ICC_Profile tags that might also be no more supported in old macOS 10.13?

exiftool 13.17 and earlier could delete ICC_Profile from .heic and such images could no more be opened unless the ICC_Profile was extracted from another .heic and copied back:

exiftool -ICC_Profile -b source.heic > profile.icc

exiftool -P -overwrite_original '-ICC_Profile<=profile.icc' destination.heic

But that does not seem to quite work anymore because extracting profile.icc from a new iOS 18.2 .heic and copying it back to the very same .heic might badly mangle colors.

In exiftool 13.18 -All= does not delete ICC_Profile so the user does not anymore have to avoid that by adding --ICC_Profile:All.

exiftool -All= image.heic                                               
Warning: Not deleting permanent ICC_Profile directory - image.heic

But is it still possible to deliberately delete ICC_Profile when testing? ???

- Matti

Phil Harvey

Hi Matti,

Quote from: wywh on February 05, 2025, 03:49:56 AMextracting profile.icc from a new iOS 18.2 .heic and copying it back to the very same .heic might badly mangle colors.

The problem is that the HEIC contains multiple ICC profiles, and they are different.  But when writing ICC_Profile, ExifTool writes them all with the same profile.  Currently there is no way to write just one or the other.

QuoteBut is it still possible to deliberately delete ICC_Profile when testing? ???

You would have to override the tag with a user-defined one that sets the Protected flag to 0.

- 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

Hi Matti,

I've been working on this, and ExifTool 13.19 will have some improvements that will group the ICC_Profile for sub-images as a sub-document when reading, and only allow writing of the profile for the main image.

- 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

#3
Mainly for my reference, here is the structure of the sample HEIC image that I have been working from.  Black is for the HEIC item information (the primary item is in bold), and red is for their properties.  Each object in the diagram is labelled its item ID or property index and box name.  Multiple item ID's are indicated by a number range (eg. "1-48 hvc1" represents 48 hvc1 items, numbered 1 to 48).  Note that item 65 is missing, but that seems to be normal for HDR HEIC's written by Apple devices (the sample was from an iPhone 15 running iOS 18.1.1).



- 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 ($).