AVIF irot Box vs EXIF Orientation Metadata
When an AVIF file contains both an irot (image rotation)
box and EXIF orientation metadata, the AVIF specification mandates that
the container-level irot property takes precedence,
requiring conforming decoders to ignore the EXIF orientation tag. This
mechanism ensures consistent image presentation across platforms while
preventing "double-rotation" errors, where an image is rotated twice by
different layers of the decoding pipeline.
The irot box is an ISOBMFF (ISO Base Media File Format)
transformative property that instructs the presentation engine to rotate
the reconstructed image grid counter-clockwise by 0, 90, 180, or 270
degrees. Because AVIF is governed by the Multi-Image Application Format
(MIAF / ISO/IEC 23000-22) specifications, geometric transformations
applied at the container level represent the canonical visual
orientation of the image.
Conversely, EXIF orientation metadata exists as a payload inside a
separate metadata item (Exif item) within the container.
Tag 0x0112 in EXIF data historically conveys camera sensor
orientation. Because legacy image formats relied entirely on this tag,
many image viewers and decoders parse EXIF data before rendering.
To resolve the conflict between the two directives, the MIAF specification dictates strict precedence and encoding rules:
- Decoder Precedence: Conforming AVIF decoders must
apply the transformation defined by the
irotbox (andimirfor mirroring, if present) to render the visual presentation. The decoder must ignore the EXIF orientation tag during display to prevent applying the transformation twice. - Encoder Requirements: Specifications state that
file authors and encoders should normalize the EXIF orientation tag to
1(indicating Top-Left, or no rotation) whenever anirotorimirproperty is declared. Alternatively, encoders may strip the EXIF orientation field entirely to maintain single-source-of-truth metadata.
Despite the standard, implementation discrepancies can occur in
non-compliant software. If an outdated or naive viewer extracts the raw
AV1 bitstream and the EXIF data while ignoring ISOBMFF transformative
properties, the image may appear unrotated or misoriented. Conversely,
if a viewer processes both the irot box and the EXIF
orientation tag without checking specification constraints, the visual
output will suffer from an unintended compound rotation.
Standard-compliant modern browsers and media frameworks adhere to the
specification by rendering strictly according to the irot
box and discarding the EXIF orientation value.