Nyxiontech PDF Tools › Image to PDF

Why phone photos come out sideways in a PDF, and how to stop it

You photograph six pages of a contract, feed them to something that makes a PDF, and three of them are lying on their side. The photos are upright everywhere else: in the camera roll, in the file manager, on the phone that took them. The usual answer is to rotate the pages afterwards, and it is the wrong one. Here is what actually happened, and how to get a PDF that comes out the right way up the first time.

The photo is not sideways. It carries a note saying which way up it is.

The camera sensor is fixed in the body of the phone. It cannot turn when you turn the phone, so it always hands over its pixels the same way round, and the phone writes a small value alongside them saying how far the picture should be turned before anyone looks at it. That is the orientation tag: one of eight values, covering the four right angles and their mirror images.

Programs that read the tag show the photo upright. Programs that ignore it show you the sensor's version, on its side. Both are looking at the same file, and neither is malfunctioning. That is why a photo can be upright in your gallery and sideways the moment it lands somewhere else, and why the problem appears to come and go for no reason.

Why a PDF makes it permanent

A PDF page has no orientation tag. When a tool puts your photo into a PDF it either applies the rotation on the way in or it does not, and whichever it chose is now what everybody sees. No note is left behind for the reader to honour or ignore. The photo was ambiguous; the PDF is not.

That is also why rotating the pages afterwards is a poor repair. It does fix how the page looks, because a PDF page can carry its own rotation. But you are doing it a page at a time across a mixed batch, each page keeps the proportions it was handed, so you end up with a document of inconsistent page shapes, and you will be doing it again next time. Rotate PDF is there for when you need it, which should be seldom.

Make the PDF with the rotation already applied

Images to PDF reads the orientation tag as it decodes each photo, so the problem never arises. The browser function it uses to decode an image takes an option for precisely this, which MDN documents as orienting the image according to its EXIF orientation metadata where present (createImageBitmap), and that is the setting the tool asks for.

  1. Open Images to PDF and drop the photos on Add images. They become pages in the order of the list, one image per page, so get the order right before you build it.
  2. Choose Page size. A4 and Letter give every page the same size and fit each photo inside it. Same as image makes each page exactly as big as its photo plus the margin, which keeps the photos at full size but leaves you with a PDF of mixed page shapes.
  3. With A4 or Letter, choose Orientation. Auto turns the page sideways whenever the photo is wider than it is tall, judged after the rotation has been applied, which is what you want for a mixed batch of pages and receipts. Portrait and Landscape force the issue. With Same as image there is nothing to decide and the option is not shown.
  4. Choose Margin: None, Small or Large, which are 0, 20 and 50 points, or roughly 0, 7 and 18 millimetres.
  5. Click Create PDF. The file takes its name from the first photo, with _and_more added when there is more than one.

What the tool does to each photo

A PDF that is already sideways

If the file exists and you still have the photos, rebuild it. That takes less time than repairing it and the pages come out consistent. If the photos are gone, Rotate PDF turns pages by 90, 180 or 270 degrees and lets you pick which ones rather than turning the lot. To make the result searchable afterwards, run it through OCR: searchable PDF, which will also take the photographs directly and build the PDF itself.

Limits

Open Images to PDF