EXIF tags · Reference

EXIF Orientation: why a photo rotates or mirrors

EXIF Orientation describes how a viewer should display stored pixels. Rotating the pixels and leaving the old orientation tag in place can make another application rotate the image a second time.

By ExifGrabber · Sources reviewed · Editorial standards

The eight orientation values

Orientation is tag 0x0112 in IFD0, stored as a SHORT. These descriptions express the display transform from the stored image.

The eight orientation values
ValueDisplay transform
1Identity
2Mirror horizontally
3Rotate 180°
4Mirror vertically
5Transpose across the top-left / bottom-right diagonal
6Rotate 90° clockwise
7Transpose across the top-right / bottom-left diagonal
8Rotate 270° clockwise

Sources: ExifTool EXIF tag definitions

Read the raw orientation value

The numeric output makes it easier to compare your application’s handling with the table. If the tag is missing, record it as missing; it does not prove the file was captured without rotation.

exiftool -G1 -a -s -n -Orientation photo.jpg

A reliable image-processing pipeline

Choose one place in the pipeline to apply orientation. Once the transform is baked into pixels, write normal orientation or remove the obsolete instruction in the output. Check what the decoder already does before adding a manual transform.

Use an asymmetric test image with labeled corners to exercise all eight cases. A simple landscape photograph may hide a mirror error. Check output dimensions as well as corner positions for the four transforms that exchange width and height.

Why stripping metadata can change appearance

If the pixels still depend on the orientation tag, deleting it can change their displayed direction. Inspect the cleaned output in another viewer before distributing it.

A screenshot captures a rendered appearance, but it is a new image with its own export behavior. It is not a faithful preservation of the original file or its metadata.

Related references and tools

To cite this reference, link to this page or a section heading and include the source-review date. Examples are illustrative; they are not measurements from a camera or a live platform test. Send a correction with the affected section and supporting evidence.