Skip to content
AgileLogics

JPG to PDF

Embeds a JPG image into a new one-page PDF, sized to match the image, entirely in your browser.

How it works

Choose a JPG image and click Convert.

How does JPG to PDF conversion work here?

JPG to PDF conversion wraps a JPEG image inside a PDF page so it can be sent, printed or merged like any other document. This tool creates a one-page PDF with pdf-lib, sizes the page to match the image, and embeds the original JPEG data unchanged. It runs in your browser and produces image.pdf.

The "unchanged" part is worth explaining, because it's why the result looks exactly like your photo.

Your JPEG goes in untouched

The PDF format can store a JPEG image as-is and let the viewer decode it, using a filter called DCTDecode (ISO 32000-1, section 7.4.8). pdf-lib takes that route: it reads the image's width, height and colour mode from the JPEG header, then copies the whole file into the PDF. We checked this by converting two test images and finding each original file's exact bytes inside the output PDF.

That has three consequences:

  1. No quality loss. There's no decode and re-encode, so no new compression artefacts.
  2. Predictable size. The PDF is the JPEG plus a little under 1 KB of PDF structure. In our tests a 715-byte image produced a 1,645-byte PDF and a 1,457-byte image a 2,388-byte one.
  3. Metadata comes along. Everything inside the JPEG file travels with it, including EXIF data such as camera model, timestamp and GPS coordinates. If you're sharing a photo taken at home, check it with the EXIF viewer and strip it with the EXIF remover before converting.

Greyscale, RGB and CMYK JPEGs are all accepted, as are progressive JPEGs.

Page size follows the pixels

The page is set to the image's pixel dimensions in PDF points, and a point is 1/72 inch. Any DPI value stored in the JPEG is ignored. Some examples:

Image Pixels Page size
Instagram portrait post 1080 x 1350 15 x 18.75 in
A4 scanned at 300 dpi 2480 x 3508 34.4 x 48.7 in
US Letter scanned at 150 dpi 1275 x 1650 17.7 x 22.9 in
12-megapixel phone photo 4032 x 3024 56 x 42 in

Big numbers, but they rarely cause trouble on screen: PDF viewers open the page zoomed to fit. They matter when printing. Choose "Fit to page" or "Shrink to fit" in the print dialog, otherwise you'll print one corner of a 56-inch page. If you need a PDF that prints at true A4 or Letter size out of the box, this tool isn't the right one, since it has no paper-size or margin options.

Step by step

  1. Click Choose a JPG image and select a .jpg or .jpeg file.
  2. Click Convert.
  3. Click Download to save image.pdf.
  4. For more photos, repeat, renaming each download, then combine them with the PDF merger.

Sideways photos

Phones often store a portrait photo's pixels sideways and add an EXIF orientation tag saying "rotate 90 degrees when displaying" (CIPA DC-008, the Exif standard). Your gallery app obeys the tag. pdf-lib only reads the JPEG's frame header and never looks at EXIF, so the PDF shows the raw pixel layout and the photo can appear on its side.

Two fixes:

  • Before converting: run the photo through the EXIF remover. It redraws the image through a browser canvas, and current browsers apply the orientation tag when they decode, so the saved pixels come out upright with no tag. The trade-off is one JPEG re-encode at quality 0.95.
  • After converting: turn the page with Rotate PDF, which is lossless.

Errors

Message Cause Fix
"Choose a JPG image." No file chosen, or the file isn't an image Pick a JPEG file
"Could not convert that image: SOI not found in JPEG" The file isn't actually a JPEG, often a PNG or WebP renamed to .jpg Use PNG to PDF for PNGs, or convert other formats to JPG first
"Could not convert that image: Invalid JPEG" The file is truncated or damaged Re-export or re-download the image

There's no file size limit in the code, but the image is held in memory as base64 text during conversion, so very large files are bounded by your device's memory.

Last updated

Frequently asked questions

Does converting JPG to PDF lower the image quality?
No. The JPEG data is copied into the PDF byte for byte and decoded by the PDF viewer, so there's no second round of compression. We confirmed the original file's bytes appear unchanged inside the output.
What page size will the PDF be?
The page is exactly as many points as the image has pixels, at 72 points to the inch. A 1080 x 1350 image becomes a 15 x 18.75 inch page. Viewers scale it to fit the screen, and printing with "fit to page" scales it to the paper.
Can I put several JPGs into one PDF?
Not in one step; this tool takes one image at a time. Convert each photo, then combine the PDFs in order with Merge PDF.
Why is my photo sideways in the PDF?
Phone cameras often save the pixels in sensor orientation and add an EXIF orientation tag telling viewers to rotate them. The PDF embeds the raw pixels and ignores that tag. Re-save the photo upright first, for example with the EXIF Data Remover, or fix the PDF with Rotate PDF.
Is my image uploaded?
No. The pdf-lib library builds the PDF in your browser and the image never leaves your device.