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.
- 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.
- 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.
- 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.
- Choose Margin: None, Small or Large, which are 0, 20 and 50 points, or roughly 0, 7 and 18 millimetres.
- Click Create PDF. The file takes its name from the first photo, with
_and_moreadded when there is more than one.
What the tool does to each photo
- The photo is decoded with its orientation already applied, so the picture the tool is holding is the right way up before anything else happens.
- It is then drawn into a fresh image and encoded again. PNG files stay PNG; everything else, iPhone HEIC included, becomes JPEG at 90% quality. There is no quality setting on this page. If you want the JPEGs themselves rather than a PDF, how to convert HEIC to JPG without uploading covers that conversion on its own.
- Because the picture is written out fresh, the rotation now lives in the pixels themselves and there is no tag left for anything to ignore. The EXIF block does not survive the trip either, so the location, the camera model and the date the photo was taken do not travel into the PDF. Keep your originals if you need any of that.
- Sizes assume 96 pixels to the inch, so a photo 1920 pixels wide is 1440 points, about 508 millimetres, before it is scaled to fit the page you chose.
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
- One image per page. There is no option to put two photos on a sheet.
- JPEG encoding is lossy. At 90% a photographed page looks the same, but it is not the original bit for bit.
- A batch of full resolution phone photos makes a heavy PDF. Send them through Compress & convert images first if the file has to go by e-mail, or Compress PDF afterwards.
- It all runs in your browser, so nothing is uploaded, and a large batch on an old phone will take its time.
- The tool does not straighten a photo taken at an angle, crop the page out of the table it is lying on, or even out the lighting. For something that has to look scanned, photograph it square on in flat light.