RotatePicturesA PictureEditor.com tool

Guide

Why a photo turns sideways when you upload it

You took the picture with the phone held upright. It is upright in your camera roll. You attached it to a form, or emailed it, or dropped it into a document, and it came out on its side. Nothing is corrupted, nothing was damaged in transit, and the picture on your phone has not changed. Two programs are reading the same file and disagreeing about which way up it is, and the file allows them to.

What the camera actually did

An image sensor has a fixed relationship to the body it is bolted into. Turn the phone ninety degrees and the sensor turns with it, so the scene lands on the sensor rotated. The phone could turn the samples back before saving — several million of them — but that costs time on every shot and, for a JPEG, a generation of compression. So it does the cheap thing instead: it writes the picture exactly as the sensor read it, and adds a note saying how far round a viewer should turn it.

That note is a field in the EXIF metadata block called Orientation. It holds one number between 1 and 8. A value of 1 means the samples are already upright. A value of 6 — the most common one on a photograph taken with a phone held vertically — means the samples need turning a quarter revolution clockwise before they are shown.

Why some programs get it right and some do not

Reading that field is optional. It is metadata, not picture data, and a decoder that ignores every byte of metadata still produces a perfectly valid image — just not the one the camera intended you to see. Broadly:

  • Almost always honoured: phone galleries, desktop photo viewers, modern web browsers displaying an image directly, and most social platforms, which usually bake the correction in when they re-encode.
  • Often ignored: upload forms that generate their own preview, older content management systems, document generators and PDF pipelines, image processing scripts that were written quickly, and anything that renders the picture into a page server-side.
  • Sometimes applied twice: a pipeline where one stage bakes the correction into the samples and a later stage applies the tag as well, which is how a picture ends up rotated a further ninety degrees rather than corrected.

Government and university portals are a common place to meet the problem, because a scanned certificate is often rendered exactly as its tag instructs by the reviewer’s software and exactly as its samples sit by the upload preview — and a submission rejected for being sideways is rejected by a person, not a machine.

How to tell which half of the file is wrong

There are only two possibilities, and they need opposite repairs.

The samples are turned and the tag is honest

This is the ordinary case straight out of a camera. The picture looks right anywhere that reads the tag and wrong anywhere that does not. The repair is to turn the samples so that the file no longer needs the tag to look correct — and then set the tag to 1 so nothing turns it again.

The samples are upright and the tag is lying

This happens after something has already corrected the picture but left the metadata alone. The picture now looks wrong in the programs that read tags and right in the ones that do not, which is the exact inverse of the first case. The repair is to change the field to 1 and touch nothing else.

If you are not sure which you have, look at where it went wrong. Wrong on the website but right on the phone is case one. Wrong on the phone as well is case two.

The fix, in five steps

  1. Open the file on the orientation page. It reads the field and states the value in words before offering anything.
  2. Read the sentence under the value. It says which of the two cases the tag suggests you are in.
  3. For a file straight from a camera or a scanner, choose to bake the pixels. The saved file looks correct in every program, including the ones that ignore metadata.
  4. For a file that something has already turned, choose to rewrite the tag. The orientation field and the link to the embedded preview change; nothing else in the file is touched and no pixel is read.
  5. Send the saved file, not the original. Both repairs also unlink the embedded preview thumbnail, which is the second reason a corrected file can still look sideways.

Open the orientation page to do it now, or the batch page if a whole folder of scans has the same problem. The turn is computed on this device; the file never leaves this tab.

The thing almost nobody mentions

Cameras write a small preview picture into the EXIF block — typically 160 by 120 pixels — and a surprising number of file managers show you that preview instead of decoding the full image. Correct the main picture, leave the preview behind, and your operating system will keep showing you a sideways thumbnail of a file that is now perfectly upright. Any tool that corrects orientation without dealing with the embedded preview has fixed half the problem.

The other half nobody mentions: a missing tag cannot be repaired, only guessed at. If a file carries no orientation field, there is no information anywhere in it about which way up it belongs, and a program that turns it anyway is inventing the answer. That is why the orientation page here names a missing field as missing instead of filling it in, and why the batch queue — which reads a missing field as upright, the same instruction — copies those files through rather than turning them.

Reference for all eight values, including the four that include a mirror: the eight orientation values.