exiftool / exiftool

ExifTool meta information reader/writer

Home Page:https://exiftool.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to add Rotation tag in HEIC image

ganeshsutar-shaip opened this issue · comments

Hi,

I have a heic image which does not have a Rotation tag, when I tried to add it, it is unable to add.
I checked if that tag is writable or not, as far as I know its writable.

Command used
exiftool -Rotation=90 test.heic

Please can anyone tell, whether we can add Rotation Tag or not in heic?

Note: If heic image already has a Rotation tag, then I am able to change it.

ExifTool does not yet have the ability to add a new MatrixStructure tag to a QuickTime-format file. This will be a little tricky because of all the various types of files that use this format, and because it must be added to the correct track in the file. But I'll look into adding this feature.

@ganeshsutar-shaip Also bumped into this issue (some weird .HEIC iPhone 11 pics I got which, on some software apps like Synology Photos don't recognize the proper orientation coming from the other existing tag on the file EXIF:Orientation when a QuickTime section exists without the Rotation tag). Mac Photos app seems to handle it correctly though.

A workaround on Mac I've used is to "fake rotate" the HEIC image on Preview and save the file. It will add the QuickTime:Rotation tag which (among changing/adding other tags 😒 ) and then exiftool can change it.

@boardhead SUPER tool!!! Use it tons! Thanks for sharing and the effort.

Could you send me one of these "fake" rotated images so I will have a template for adding this information? (philharvey66 at gmail.com) thanks.

  • Phil

Sure. Tried to find a pic without much PII!! Will share to your email address!

  • On Preview app I rotated 4 times to bring it up to the same orientation. And hit Save.
File exiftool -G -u -a output file Remarks
IMG_20221111_203203 (original).HEIC IMG_20221111_203203 (original).txt Original file I got.
IMG_20221111_203203.HEIC IMG_20221111_203203.txt File rotated 4 times in Preview and saved
  • diff on the result of exiftool -G -u -a on both files.
  • Entry [QuickTime] Rotation : 0 was added!
  • The MakerNotes seem to have changed only.. but that's a different topic altogether ;)
  • EXIF Orientation was changed !!!
  • Image Width and Height were switched!
diff IMG_20221111_203203\ \(original\).txt IMG_20221111_203203.txt 
2,3c2,3
< [ExifTool]      Now                             : 2022:12:28 14:40:19+00:00
< [ExifTool]      New GUID                        : 20221228-1440-1900-32EC-860DA5606FBD
---
> [ExifTool]      Now                             : 2022:12:28 14:40:53+00:00
> [ExifTool]      New GUID                        : 20221228-1440-5300-3302-24B926FAEDF7
5,7c5,7
< [ExifTool]      Processing Time                 : 0.113 s
< [File]          File Name                       : IMG_20221111_203203 (original).HEIC
< [File]          Base Name                       : IMG_20221111_203203 (original)
---
> [ExifTool]      Processing Time                 : 0.115 s
> [File]          File Name                       : IMG_20221111_203203.HEIC
> [File]          Base Name                       : IMG_20221111_203203
9,13c9,13
< [File]          File Path                       : /Users/MSP/Downloads/IMG_20221111_203203 (original).HEIC
< [File]          File Size                       : 1250 kB
< [File]          File Modification Date/Time     : 2022:11:11 20:32:03+00:00
< [File]          File Access Date/Time           : 2022:12:28 14:39:26+00:00
< [File]          File Inode Change Date/Time     : 2022:12:28 14:39:26+00:00
---
> [File]          File Path                       : /Users/MSP/Downloads/IMG_20221111_203203.HEIC
> [File]          File Size                       : 1208 kB
> [File]          File Modification Date/Time     : 2022:12:28 14:40:38+00:00
> [File]          File Access Date/Time           : 2022:12:28 14:40:42+00:00
> [File]          File Inode Change Date/Time     : 2022:12:28 14:40:39+00:00
17c17
< [File]          File Inode Number               : 75171093
---
> [File]          File Inode Number               : 75171338
23c23
< [File]          File Block Count                : 2448
---
> [File]          File Block Count                : 2360
25,27c25,33
< [File]          KMD Item Display Name With Extensions: IMG_20221111_203203 (original).HEIC
< [File]          MD Item Content Creation Date   : 2022:12:03 16:24:47+00:00
< [File]          MD Item Content Creation Date Ranking: 2022:12:03 00:00:00+00:00
---
> [File]          KMD Item Display Name With Extensions: IMG_20221111_203203.HEIC
> [File]          MD Item Acquisition Make        : Apple
> [File]          MD Item Acquisition Model       : iPhone 11
> [File]          MD Item Altitude                : 43.4976904265918
> [File]          MD Item Aperture                : 1.69599381283836
> [File]          MD Item Bits Per Sample         : 24
> [File]          MD Item Color Space             : RGB
> [File]          MD Item Content Creation Date   : 2022:11:11 20:32:03+00:00
> [File]          MD Item Content Creation Date Ranking: 2022:11:11 00:00:00+00:00
32c38,39
< [File]          MD Item Date Added              : 2022:12:28 14:39:26+00:00
---
> [File]          MD Item Creator                 : 16.0
> [File]          MD Item Date Added              : 2022:12:28 14:37:08+00:00
34,36c41,51
< [File]          MD Item Display Name            : IMG_20221111_203203 (original).HEIC
< [File]          MD Item Document Identifier     : 0
< [File]          MD Item FS Content Change Date  : 2022:11:11 20:32:03+00:00
---
> [File]          MD Item Display Name            : IMG_20221111_203203.HEIC
> [File]          MD Item Document Identifier     : 2919
> [File]          MD Item EXIF Version            : 2.3.2
> [File]          MD Item Exposure Mode           : 0
> [File]          MD Item Exposure Program        : 2
> [File]          MD Item Exposure Time Seconds   : 0.02
> [File]          MD Item Flash On Off            : 0
> [File]          MD Item F Number                : 1.8
> [File]          MD Item Focal Length            : 4.25
> [File]          MD Item Focal Length 35mm       : 26
> [File]          MD Item FS Content Change Date  : 2022:12:28 14:40:38+00:00
45c60
< [File]          MD Item FS Name                 : IMG_20221111_203203 (original).HEIC
---
> [File]          MD Item FS Name                 : IMG_20221111_203203.HEIC
49c64
< [File]          MD Item FS Size                 : 1249510
---
> [File]          MD Item FS Size                 : 1207925
51c66,70
< [File]          MD Item Interesting Date Ranking: 2022:11:11 00:00:00+00:00
---
> [File]          MD Item GPS Dest Bearing        : 260.8976135488838
> [File]          MD Item Has Alpha Channel       : 0
> [File]          MD Item Image Direction         : 260.8976135488838
> [File]          MD Item Interesting Date Ranking: 2022:12:28 00:00:00+00:00
> [File]          MD Item ISO Speed               : 320
53,54c72,96
< [File]          MD Item Logical Size            : 1249510
< [File]          MD Item Physical Size           : 1253376
---
> [File]          MD Item Last Used Date          : 2022:12:28 14:40:29+00:00
> [File]          MD Item Last Used Date Ranking  : 2022-12-28 00:00:00 +0000
> [File]          MD Item Latitude                : 52.77171666666667
> [File]          MD Item Logical Size            : 1207925
> [File]          MD Item Longitude               : -1.206378333333333
> [File]          MD Item Metering Mode           : 5
> [File]          MD Item Orientation             : 1
> [File]          MD Item Physical Size           : 1208320
> [File]          MD Item Pixel Count             : 12192768
> [File]          MD Item Pixel Height            : 4032
> [File]          MD Item Pixel Width             : 3024
> [File]          MD Item Profile Name            : Display P3
> [File]          MD Item Red Eye On Off          : 0
> [File]          MD Item Resolution Height DPI   : 72
> [File]          MD Item Resolution Width DPI    : 72
> [File]          MD Item Speed                   : 0.08305940763567882
> [File]          MD Item Use Count               : 5
> [File]          MD Item Used Dates              : 2022:12:28 00:00:00+00:00
> [File]          MD Item User Modified Date      : 2022:12:28 14:40:38+00:00
> [File]          MD Item User Modified User Handle: 501
> [File]          MD Item White Balance           : 0
> [File]          X Attr Last Used Date           : 2022:12:28 14:40:29
> [File]          X Attr Macl                     : (Binary data 72 bytes, use -b option to extract)
> [File]          X Attr MD Label                 : (Binary data 89 bytes, use -b option to extract)
> [File]          X Attr Quarantine               : Flags=0082 set at 2022:12:28 14:40:37 by Preview
59,60c101,102
< [File]          Image Width                     : 4032
< [File]          Image Height                    : 3024
---
> [File]          Image Width                     : 3024
> [File]          Image Height                    : 4032
63c105
< [QuickTime]     Compatible Brands               : heic, mif1
---
> [QuickTime]     Compatible Brands               : mif1, miaf, MiHB, heic
66c108
< [QuickTime]     Meta Image Size                 : 4032x3024
---
> [QuickTime]     Meta Image Size                 : 3024x4032
70,71c112,113
< [QuickTime]     General Profile IDC             : Main Still Picture
< [QuickTime]     Gen Profile Compatibility Flags : Main Still Picture, Main 10, Main
---
> [QuickTime]     General Profile IDC             : Main
> [QuickTime]     Gen Profile Compatibility Flags : Main 10, Main
82c124
< [QuickTime]     Temporal ID Nested              : No
---
> [QuickTime]     Temporal ID Nested              : Yes
84c126,127
< [QuickTime]     Image Spatial Extent            : 4032x3024
---
> [QuickTime]     Image Spatial Extent            : 3024x4032
> [QuickTime]     Rotation                        : 0
86,105c129,131
< [QuickTime]     HEVC Configuration Version      : 1
< [QuickTime]     General Profile Space           : Conforming
< [QuickTime]     General Tier Flag               : Main Tier
< [QuickTime]     General Profile IDC             : Main Still Picture
< [QuickTime]     Gen Profile Compatibility Flags : Main Still Picture, Main 10, Main
< [QuickTime]     Constraint Indicator Flags      : 176 0 0 0 0 0
< [QuickTime]     General Level IDC               : 60 (level 2.0)
< [QuickTime]     Min Spatial Segmentation IDC    : 0
< [QuickTime]     Parallelism Type                : 0
< [QuickTime]     Chroma Format                   : 4:2:0
< [QuickTime]     Bit Depth Luma                  : 8
< [QuickTime]     Bit Depth Chroma                : 8
< [QuickTime]     Average Frame Rate              : 0
< [QuickTime]     Constant Frame Rate             : Unknown
< [QuickTime]     Num Temporal Layers             : 1
< [QuickTime]     Temporal ID Nested              : No
< [QuickTime]     Image Spatial Extent            : 320x240
< [QuickTime]     Media Data Size                 : 1245180
< [QuickTime]     Media Data Offset               : 4330
< [QuickTime]     Media Data                      : (Binary data 1245180 bytes, use -b option to extract)
---
> [QuickTime]     Media Data Size                 : 1204618
> [QuickTime]     Media Data Offset               : 3307
> [QuickTime]     Media Data                      : (Binary data 1204618 bytes, use -b option to extract)
108c134
< [EXIF]          Orientation                     : Rotate 90 CW
---
> [EXIF]          Orientation                     : Horizontal (normal)
157c183
< [EXIF]          GPS Speed                       : 0.0830594077
---
> [EXIF]          GPS Speed                       : 0.08305940764
164c190
< [MakerNotes]    Apple 0x0002                    : ?????.?..?.?ۑ(.G.....?ε̢?.??K.???[...]
---
> [MakerNotes]    Apple 0x0002                    : bplist00O..?????.?..?.?ۑ(.G.....?ε̢?[...]
202a229,234
> [XMP]           XMP Toolkit                     : XMP Core 6.0.0
> [XMP]           Create Date                     : 2022:11:11 20:32:03.734
> [XMP]           Creator Tool                    : 16.0
> [XMP]           Modify Date                     : 2022:11:11 20:32:03.734
> [XMP]           Composite Image                 : 2
> [XMP]           Date Created                    : 2022:11:11 20:32:03.734
231c263
< [Composite]     Image Size                      : 4032x3024
---
> [Composite]     Image Size                      : 3024x4032
241c273
< [Composite]     Base Name                       : IMG_20221111_203203 (original)
---
> [Composite]     Base Name                       : IMG_20221111_203203
245c277
< [Composite]     Physical Image Size             : 56.0x42.0 inches
---
> [Composite]     Physical Image Size             : 42.0x56.0 inches```

Interesting, thanks. I got the files.

Preview actually rotated the image to the orientiation indicated by the EXIF:Orientation tag, and added a QuickTime:Rotation tag (as you had mentioned, but I was thinking that the QuickTime::MatrixStructure would be written, which is the basis for a Composite:Rotation tag and is the rotation method used by QuickTime videos).

Adding the ability to create this tag will be difficult since it is nested deeply within the item properties and ExifTool doesn't yet have the ability to add new properties, but I will look into this. It will involve not only adding a new property, but also adding a new property association entry, which will be tricky.

  • Phil