AVIF Orientation Flags vs EXIF Orientation Tags

While traditional image formats like JPEG typically rely on embedded EXIF metadata tags to dictate image rotation and flipping, the AV1 Image File Format (AVIF) handles orientation natively at the container level. This article explains the technical differences between legacy EXIF orientation tags and AVIF's structural transformation properties, how conflicts between the two are resolved, and why the AVIF implementation leads to more reliable image rendering across the web.

The Traditional Approach: EXIF Orientation Tags

In legacy formats such as JPEG, TIFF, and WebP, orientation is defined within an embedded EXIF (Exchangeable Image File Format) metadata block. The camera or software writes a value from 1 to 8 into the EXIF Orientation tag (tag ID 0x0112).

These eight integer values represent:

Because EXIF is a secondary metadata payload rather than a core structural element of the image bitstream, decoders must parse this external block to display the image properly. If an image optimizer or Content Delivery Network (CDN) strips EXIF data to reduce file size or preserve user privacy, the orientation information is lost, frequently causing images to display upside down or sideways.

The AVIF Approach: ISOBMFF Transform Properties

AVIF is derived from the HEIF specification, which is built on top of the ISO Base Media File Format (ISOBMFF). Instead of delegating display geometry solely to an embedded EXIF chunk, AVIF uses native ISOBMFF item properties to define transformations.

Orientation in AVIF is primarily controlled by two container-level properties:

  1. irot (Image Rotation): Specifies the counter-clockwise rotation applied to the reconstructed image. The box contains a 2-bit integer that represents 0, 90, 180, or 270 degrees of rotation.
  2. imir (Image Mirroring): Specifies whether a horizontal or vertical flip should be applied before or after rotation.

These properties are part of the file's primary structural item properties box (iprp). Because they are native container elements, an AVIF decoder can determine the correct display layout immediately upon reading the file header, without parsing deep metadata structures.

Handling Conflicts: Preventing "Double Rotation"

AVIF files can still contain an embedded EXIF metadata payload to preserve camera settings, timestamps, and geolocation. However, this introduces the potential for conflicting orientation instructions if both an irot/imir property and an EXIF tag 0x0112 exist.

The AVIF specification explicitly outlines how to handle this to avoid "double rotation":

Key Advantages of AVIF's Approach

By moving orientation from EXIF to the container format, AVIF offers several structural improvements: