How is ExifTool "fixing" HEIC files to make metadata readable by other apps?

Started by dlgkjfgkwrj, September 26, 2021, 03:24:21 PM

Previous topic - Next topic

dlgkjfgkwrj

I'm currently evaluating two digital asset managers, namely IMatch and digiKam.

Apparently digiKam only has partial support for HEIC (the new image format which is now used by iPhones). You can view the metadata in a special ExifTool tab, which was only just added in the latest release. I'm not 100% sure but I believe that this tab is just a display, none of that output is actually used for any purpose in the rest of the app. For example even although you can see the orientation tag, the application isn't able to use it to actually orient the image. The other metadata tabs (EXIF, Makernote, IPTC, and XMP) use a competing metadata tool that isn't able to handle HEIC file, so those are just blank.

Here is where my question regarding ExifTool starts. I found that when I do face tagging in IMatch (which uses ExifTool for metadata operatopms), and then write-back the metadata to the files, that this somehow makes digiKam also able to now read and understand the metadata.

It's like somehow processing the HEIC images with ExifTool makes those same image's metadata now readable by other programs. I'm trying to learn as much as I can about image metadata, but I don't understand how this could be possible. The image is still an HEIC image, so how are other programs suddenly able to read it after processing ExifTool?

Is there some way I could process the files with ExifTool directly, to have the same effect of "fixing" the files, without having to go through IMatch?

Phil Harvey

Quote from: dlgkjfgkwrj on September 26, 2021, 03:24:21 PM
The other metadata tabs (EXIF, Makernote, IPTC, and XMP) use a competing metadata tool that isn't able to handle HEIC file, so those are just blank.

I think you mean Exiv2?  This isn't a competing tool... we have a cooperative relationship. ;)

QuoteThe image is still an HEIC image, so how are other programs suddenly able to read it after processing ExifTool?

No idea, unless maybe iMatch is writing XMP which typically doesn't exist in an original HEIF image, and maybe the other programs can read XMP?

QuoteIs there some way I could process the files with ExifTool directly, to have the same effect of "fixing" the files, without having to go through IMatch?

Certainly, but you'd have to spend more time looking at the files with ExifTool to figure out exactly what IMatch is doing.

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

StarGeek

Quote from: dlgkjfgkwrj on September 26, 2021, 03:24:21 PMIt's like somehow processing the HEIC images with ExifTool makes those same image's metadata now readable by other programs. I'm trying to learn as much as I can about image metadata, but I don't understand how this could be possible. The image is still an HEIC image, so how are other programs suddenly able to read it after processing ExifTool?

I don't believe IMatch writes to HEIC by default.  Instead, it writes to an XMP sidecar file, which is supported by DigiKam.

Open up the directory that has the HEIC files and see if there are XMP sidecar files.  They will have the same name as the HEIC file except they'll have an XMP extension.

If not, run exiftool on one of the files before and after tagging, using the command in FAQ #3,  to see the difference.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

dlgkjfgkwrj

Thanks for both replies.

As far as the sidecars, I wasn't using that feature. But maybe this would be an easier option than modifying the HEIC files directly.

And as far as the XMP, I think you are correct. It seems that IMatch gathers the metadata from all the different types (EXIF, IPTC, and XMP), merges it into a "rich" metadata set, and then writes that "rich" metadata back to XMP.

QuoteWhen IMatch indexes a file, it imports existing metadata and produces a rich XMP record from the data found in the file. This includes mapping EXIF, legacy IPTC and GPS metadata into their XMP counterparts. If the file already has XMP metadata, it is upgraded / merged with the XMP metadata produced by IMatch.

I was able to use the https://raw.githubusercontent.com/exiftool/exiftool/master/arg_files/exif2xmp.args "script" which I guessed might exist from this post https://exiftool.org/forum/index.php?topic=11867.msg63997#msg63997.

I don't know if this is specific to the way digiKam populates the metadata tabs, but after running this script (which copies EXIF to XMP), I am able to see not only the XMP values, but also all the EXIF values as well.

dlgkjfgkwrj

Actually, I did some more testing and it does seem, in-fact, that ExifTool is "fixing" something.

I tried running `exiftool -XMP-xmp:CreateDate<EXIF:CreateDate MYIMAGE.HEIC`. This should have only copied a single tag to XMP, but I am now able to view ALL the EXIF tags normally, not just the one I copied to XMP. It seems that whatever way ExifTool is writing the file is making the metadata work, while the Apple version doesn't.

Is there some way to rewrite the file through ExifTool without having to copy any tags?

StarGeek

You could pick a tag and just copy it back onto itself.  For example, using the CreateDate
exiftool -TagsFromFile @ -XMP:CreateDate /path/to/files/

Or just bulk set another XMP tag
exiftool "-XMP:PreservedFileName<Filename" /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

dlgkjfgkwrj

I tried doing exiftool -TagsFromFile @ -XMP:CreateDate /path/to/files/ as suggested, and that had the same effect of "fixing" the file. I diffed the output of `exiftool -a -s -G1 PHOTO.HEIC` and all the metadata tags were the same, except for one or two bytesize things. I'm not really sure what is happening, but at this point it works for my workflow.

Thanks

mulder911

For anyone else looking into this for Digikam, it appears to not write to HEIC files (captions) but in Digikam under preferences Metadata if you turn on write to XMP sidecar files for read only files it will write the caption to a XMP file for HEIC instead of just storing it in the Digikam database.

robertoleonardo

adding to this - imatch does write directly to heic files (though not sure if it is default or if default is sidecars), but yes as phil said - it writes to the xmp group. so, xmp:subject, etc. also quasi related, and it took me a while to figure out so just in case it helps -- imatch uses exiftool and it has a custom config file. so if you run into any weird issues when it is writing that can be fixed via config file -- look for et_match.config in the program folder.