Extracting thumbnail from HEIC files (from iPhone)

Started by dalgaard, June 10, 2021, 02:19:46 AM

Previous topic - Next topic

dalgaard

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

Luuk2005

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.
Windows8.1-64bit,  exiftool-v12.92(standalone),  sed-v4.0.7

dalgaard

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?

Alan Clifford

#3
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

Luuk2005

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.
Windows8.1-64bit,  exiftool-v12.92(standalone),  sed-v4.0.7

greybeard

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.

Phil Harvey

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

greybeard

Interesting - is this a general HEIC thing or specific to the Apple implementation? The Fujifilm .hif files have genuine embedded jpeg thumbnails.

Phil Harvey

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
...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

There are some cool segmentation mattes and a depth map internally, which is at least greater than 0...  - J