EXIF Orientation: why some photos show up sideways
EXIF Orientation tells software how to rotate a photo for display. The eight values, why photos appear sideways, and why cleaning must keep this tag.
What is the EXIF Orientation tag?
Orientation
Orientation is an EXIF tag, number 0x0112 in the first image directory (IFD0), that records how the stored pixels must be rotated or mirrored before display. Its value is a whole number from 1 to 8.
A camera sensor has one native layout, usually landscape. When you turn the phone to shoot a portrait, most cameras do not rotate the pixels. They save the image as the sensor saw it and write the correction into this tag. The viewer is expected to apply it.
What do the eight values mean?
| Value | Instruction |
|---|---|
| 1 | Display as stored |
| 2 | Mirror horizontally |
| 3 | Rotate 180° |
| 4 | Mirror vertically |
| 5 | Mirror horizontally, then rotate 270° clockwise |
| 6 | Rotate 90° clockwise |
| 7 | Mirror horizontally, then rotate 90° clockwise |
| 8 | Rotate 270° clockwise |
Values 1, 3, 6 and 8 cover a camera held level, upside down, or turned either way. The mirrored values are rare in camera output.
What we measured
We made a 400 × 300 pixel JPEG and set Orientation to 6. ExifTool reports it as Rotate 90 CW, and software that honours the tag shows the picture as a 300 × 400 portrait. Nothing about the pixels changed; the tag alone decides which way up the image appears.
We then removed all metadata from two copies of that file.
- A plain
exiftool -all=deleted the tag. The file now displays as a landscape image lying on its side. - Our own cleaning, the code behind the metadata remover, removed everything else and wrote
Orientationback. The tag still readRotate 90 CW, and the pixel data was byte for byte identical to the original.
That difference is why a careless cleaner turns portrait photos sideways.
Why do photos turn sideways?
Two situations produce it, and they fail in opposite directions.
- The tag is removed but the pixels are not rotated. A cleaner or an export strips metadata without applying the turn first. The file no longer knows it was a portrait.
- The tag is kept but ignored. Software that does not read Orientation shows the stored layout. The same file looks right in one app and wrong in another.
Rotating a photo in an editor usually fixes both at once: it turns the pixels and resets the tag to 1, so there is nothing left to interpret.
Is Orientation a privacy risk?
No. It says how the camera was held, nothing about who held it or where. It is one of the two things worth keeping when you clean a photo, the other being the colour profile.