-
Notifications
You must be signed in to change notification settings - Fork 254
Closed
Description
Converting a JPG image to AVIF using avifenc and then converting the AVIF back to JPG using avifdec will write the wrong Orientation in the EXIF data.
Version
avifenc -V
Version: 1.0.4 (dav1d [dec]:1.4.1, libgav1 [dec]:0.18.0, aom [enc/dec]:v3.8.2, rav1e [enc]:0.7.1 (UNKNOWN), svt [enc]:v1.7.0)
libyuv : available (1883)JPG to AVIF
avifenc -q 70 input.jpg output.avif
Directly copied JPEG pixel data (no YUV conversion): input.jpg
Successfully loaded: input.jpg
AVIF to be written: (Lossy)
* Resolution : 4000x2252
* Bit Depth : 8
* Format : YUV420
* Chroma Sam. Pos: 0
* Alpha : Absent
* Range : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile : Present (632 bytes)
* XMP Metadata : Absent
* Exif Metadata : Present (33975 bytes)
* Transformations:
* irot (Rotation) : 3
* Progressive : Unavailable
Encoding with AV1 codec 'aom' speed [6], color quality [70 (Medium)], alpha quality [100 (Lossless)], tileRowsLog2 [0], tileColsLog2 [0], 1 worker thread(s), please wait...
Encoded successfully.
* Color AV1 total size: 1367241 bytes
* Alpha AV1 total size: 0 bytes
Wrote AVIF: output.avif* irot (Rotation) : 3 is the angle and means (90 * ANGLE) degree rotation anti-clockwise, which is correct, 90*3=270° anti-clockwise which equals the original JPG Orientation of 90° clockwise (CW) :
$ exiftool -a -u -g1 input.jpg | grep Orientation
Orientation : Rotate 90 CW
$ exiftool -Orientation# input.jpg
Orientation : 6AVIF to JPG
avifdec output.avif upsidedown.jpg
Decoding with AV1 codec 'dav1d' (1 worker thread), please wait...
Image decoded: output.avif
Image details:
* Resolution : 4000x2252
* Bit Depth : 8
* Format : YUV420
* Chroma Sam. Pos: 0
* Alpha : Absent
* Range : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile : Present (632 bytes)
* XMP Metadata : Absent
* Exif Metadata : Present (33975 bytes)
* Transformations:
* irot (Rotation) : 3
* Progressive : Unavailable
Wrote JPEG: upsidedown.jpgIssue
6 and 8 EXIF Orientations are swapped in avifImageGetExifOrientationFromIrotImir()
$ exiftool -a -u -g1 upsidedown.jpg | grep Orientation
Orientation : Rotate 270 CW
$ exiftool -Orientation# upsidedown.jpg
Orientation : 8Resulting in an upsidedown JPG
A temporary "solution" is manually changing Rotation before using avifdec:
$ exiftool -QuickTime:Rotation=90 output.avifThis will create an avif file with a wrong rotation but will make avifdec wrongly output a correct orientation of 6 (Rotate 90 CW) JPG
Metadata
Metadata
Assignees
Labels
No labels