ExifTool Forum

ExifTool => Newbies => Topic started by: dalgaard on June 10, 2021, 02:19:46 AM

Title: Extracting thumbnail from HEIC files (from iPhone)
Post by: dalgaard on June 10, 2021, 02:19:46 AM
I am using Exiftool from Synology DSM and from Windows 10. Everything works fine when using jp-files including extracting thumbnails,  I am also able to extract all information from HEIC-files, but I can't get the thumnail from HEIC-files.

I am using this command:
exiftool -b -ThumbnailImage IMG_5642.HEIC > IMG_5642_tn.HEIC

I do get the file IMG_5642_tn.HEIC, but it is empty!

Please advice
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: Luuk2005 on June 10, 2021, 11:55:23 AM
When using >, the shell always wants to write a file, even without any $ThumbnailImage inside of the heic file.
You could study them first like... exiftool -r -ext heic -if "not $ThumbnailImage" -p "$Directory/$Filename" DIR
So then you could know which .heic files still need to recieve their thumbnails being inserted.

Or also to use something like... exiftool -r -b -ext heic -ThumbnailImage -w _tn.heic DIR
So then its only creating the real thumbnails, but not creating the empty-files.
Title: Re: Extracting thumbnail from HEIC files (from iPhone)- NO THUMBNAILS!
Post by: dalgaard on June 10, 2021, 03:29:23 PM
Thx for your suggestions, it looks like none of the HEIC images from my iPhone (IOS 14.x) has a thumbnail.

So now I have a new question: How can I resize a HEIC image and save it as a thumbnail?
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: Alan Clifford on June 10, 2021, 03:56:32 PM
ImageMagick will create a different size file for you.  Apparently it can deal with heic so the comand would be something like

convert -resize 100x100 photo.heic  temp_tn.heic
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: Luuk2005 on June 10, 2021, 05:35:19 PM
Greetings everyone! Im very unfamiliar with metadata, so is it typical that .heic not having embedded preview-images????
I dont know all the other $TagNames for preview-images besides $ThumbnailImage, but you can search for them like...
exiftool -s -r -ext heic -if "$Preview:All" -Preview:All  DIR

So that could present any other $TagNames, that maybe is where your heic-files have their preview-images settled.
Also, if never having any previews... Can ImageMagick also save the output as jpeg, while creating the thumbnail?
So what Im thinking, is maybe somehow creating the thumbnails like... SameFilename.jpg

So then he could use something like...
exiftool -r -overwrite_original -ext heic -ThumbnailImage"<=%d%f.jpg" DIR
To insert the thumbnails into the .heic files, and not to worry about missing preview-images.
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: greybeard on October 28, 2022, 04:55:26 AM
Bringing this post back to life.

Has anyone found where the thumbnails are kept in Apple HEIF files?

I'm assuming they exist as the Apple files app shows them.
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: Phil Harvey on October 31, 2022, 11:38:54 AM
There is no stand-alone thumbnail file inside an heic image.  The thumbnail data is stored in hvc format in an heic file, but ExifTool doesn't extract it because it is not viewable as a stand-alone file.  It would need to be somehow wrapped in an heic container to be viewable.

- Phil
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: greybeard on November 02, 2022, 05:34:09 AM
Interesting - is this a general HEIC thing or specific to the Apple implementation? The Fujifilm .hif files have genuine embedded jpeg thumbnails.
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: Phil Harvey on November 02, 2022, 08:12:01 AM
Excellent point!  These JPEG previews don't exist in any of my other HEIC samples (Apple and Canon), but the are in the FujiFilm HIF images.  ExifTool wasn't extracting these, but I will add this ability in version 12.50.

- Phil
Title: Re: Extracting thumbnail from HEIC files (from iPhone)
Post by: blue-j on November 03, 2022, 12:22:07 AM
There are some cool segmentation mattes and a depth map internally, which is at least greater than 0...  - J