Menu

1 / 2

Your Downloaded Images Are Sideways: Parsing EXIF Orientation in JPEG, WebP and AVIF

DEV Community: frontend·eden zhang·12 days ago
#x9zoeXEl
#devtofrontend#devto#dev#orientation#exif
Long article (1700 words) — no AI summary yet.
Reading 0:00
15s threshold

Every image collector eventually ships a bug report that reads like this: "the images I downloaded are rotated 90 degrees." And every developer answers it once with "that's just how the camera saved it", and then spends three hours discovering that it is not that simple.

The pixels on disk are not rotated. The file declares a rotation. Two different consumers — your browser, your image viewer, your design tool — disagree about whether to apply that declaration, and the one that disagrees with your pipeline is the one your user opens first.

This post is about where that declaration lives, byte by byte, in JPEG, WebP and AVIF, what browsers actually do with it, and why "just rotate it afterwards" is a trap that produces double-rotated images in production.

The photo was never sideways

A modern phone camera has a sensor that is physically landscape.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.