Hello,
I'm able to use exiftool to modify QuickTime:Rotation in HEIC file only if it already exists. If it doesn't exist, it doesn't get added and the file is unchanged. Would be very nice to be able to set this tag regardless of whether it already exists, to losslessly rotate HEIC files.
(attempts to copy this tag from another file where it exists with -tagsFromFile, or copy all QuickTime tags as a block, all failed as well)
Thank you!!
* using ExifTool 12.40
Is this a field for videos only, or images, too?
- J
Quote from: blue-j on February 21, 2022, 04:14:36 PM
Is this a field for videos only, or images, too?
In my case, images; don't know about videos. Latest Samsung phones can save photos as HEIC files, with QuickTime tag group. Photos in portrait orientation have Rotation tag set in QuickTime and Orientation in EXIF, but in landscape orientation, Rotation in QuickTime is not present. As a result I can rotate some images by rewriting both QuickTime:Rotation and EXIF:Orientation, but not others (apparently rewriting just the latter is not sufficient for some viewers).
Quote from: olegos on February 23, 2022, 01:42:30 AM
Latest Samsung phones can save photos as HEIC files, with QuickTime tag group. Photos in portrait orientation have Rotation tag set in QuickTime and Orientation in EXIF, but in landscape orientation, Rotation in QuickTime is not present.
iPhone 13 Pro has the following for .heic:
exiftool -a -G1 -s -Rotation -Orientation *.heic
======== horizontal.heic
[QuickTime] Rotation : 0
[IFD0] Orientation : Horizontal (normal)
[XMP-tiff] Orientation : Horizontal (normal)
======== portrait.heic
[QuickTime] Rotation : 270
[IFD0] Orientation : Rotate 90 CW
[XMP-tiff] Orientation : Rotate 90 CW- Matti
Quote from: wywh on February 23, 2022, 06:44:20 AM
iPhone 13 Pro has the following for .heic:
exiftool -a -G1 -s -Rotation -Orientation *.heic
Here's the same for HEIC from Samsung Galaxy S21:
exiftool -a -G1 -s -Rotation -Orientation 20211001_174412.heic
[QuickTime] Rotation : 270
[QuickTime] Rotation : 270
[IFD0] Orientation : Rotate 90 CW
exiftool -a -G1 -s -Rotation -Orientation 20211001_072126.heic
[IFD0] Orientation : Horizontal (normal)
Ping. This still doesn't work with the latest version, 12.61. So I cannot losslessly rotate HEIC images from Samsung phones by modifying Rotation/Orientation, the way I can with jpegs. Doesn't work only if the originals are in landscape orientation, and works properly if the images start in portrait orientation.
Attached is an example of an image that I cannot rotate by just modifying the metadata
Quote from: olegos on April 29, 2023, 02:25:39 PMrotate by just modifying the metadata
Try:
exiftool -n -IFD0:Orientation=6 test.heic
exiftool -a -G1 -s -n test.heic
[IFD0] Orientation : 6
Unlike exiftool (?), macOS 13 Ventura Preview can also add QuickTime:Rotation. IFD0:Orientation remains the same but at least Mac apps correctly display the rotated .heic:
[QuickTime] Rotation : 0
[IFD0] Orientation : 1
After that, this exiftool command succeeds to turn the .heic up-side-down:
exiftool -n -QuickTime:Rotation=180 test.heic
[QuickTime] Rotation : 180
[IFD0] Orientation : Horizontal (normal)
Which tag (or both) is the standard?
- Matti
Can you share an image that is already rotated properly without editing to compare?
Edit: The problem seems to be the lack of the QuickTime:MatrixStructure tag. With my quick tests and limited samples, the files that had the QuickTime:MatrixStructure could be rotated and the ones without could not. But when it comes down to it, no viewer I tried was honoring the EXIF:Orientation.
Phil, since HEIC are closely related to videos, are they the same in that there isn't a standard for embedding EXIF data?
Quote from: StarGeek on April 29, 2023, 03:58:30 PMCan you share an image that is already rotated properly without editing to compare?
See the two attached files. The _original one is how it came off the phone. The rotated one is the result of
exiftool -Orientation=3 -QuickTime:Rotation=0 20211227_164541.heic
Edit: apparently I messed up Orientation there, but it doesn't seem to matter anyway, only QuickTime:Rotation seems to matter. The final file is shown rotated properly in several viewers I've tried (in Windows).
Quote from: StarGeek on April 29, 2023, 03:58:30 PMPhil, since HEIC are closely related to videos, are they the same in that there isn't a standard for embedding EXIF data?
HEIC does support EXIF, and many of the samples I have store both EXIF:Orientation and QuickTime:Rotation, but some have EXIF:Orientation only.
- Phil
So the root question is still the same. Is it possible to add the QuickTime:MatrixStructure to a file that doesn't have it to begin with?
ExifTool can't currently do that.
- Phil
I just ran some tests, and MacOS Mojave software respects the EXIF:Orientation tag in HEIC images, but apparently newer versions of the software rotate images differently than Mojave.
- Phil