Docento.app Logo
Docento.app
Analytics dashboard on a laptop screen
All Posts

How to Batch Convert Images to PDF for Scanned Documents and Photo Sets

April 28, 2026·7 min read

If you have a folder of scanned receipts, a stack of phone photos of a contract, or a few hundred product photos that need to live in a single bundle, batch-converting images to PDF turns the mess into a single tidy document. The conversion mechanics are simple. The decisions, ordering, compression, OCR, page sizing, are what make the difference between a usable PDF and a 200 MB monster. This guide walks through the practical workflow.

The two flavors of "images to PDF"

There are two distinct jobs:

  1. One PDF per image set. Take 50 images and produce a single multi-page PDF. This is the document use case (a scanned contract, a photographed receipt book).
  2. One PDF per image. Take 50 images and produce 50 single-page PDFs. This is the asset use case (each product photo becomes a standalone PDF for distribution).

The tools are similar, but the commands differ.

Tools, ranked by use case

For desktop one-off conversion:

  • Preview on macOS. Drag images into the sidebar in the desired order, then File → Print → Save as PDF. Easy.
  • Photos app + Print to PDF on Windows. Select images, right-click → Print → Microsoft Print to PDF. Easy but limited control.
  • Image viewer in Linux desktops. Most file managers have "Convert to PDF" via plugins.

For CLI batch processing:

  • img2pdf, Python tool optimized for lossless image-to-PDF conversion. img2pdf *.jpg -o output.pdf. Preserves the original image bytes (no recompression). The gold standard for this job.
  • ImageMagick. convert *.jpg output.pdf. Recompresses images by default; pass -quality 100 for high quality. Slower than img2pdf for large batches.
  • Ghostscript, combine with other tools; not the most direct for raw image conversion.
  • PowerShell or bash one-liners wrapping the above.

For online or GUI batch tools:

  • Smallpdf, iLovePDF, Adobe Acrobat Online, drag-and-drop multi-image to single PDF. See Smallpdf vs iLovePDF.
  • Foxit, Nitro, PDFelement, same workflow with desktop apps.

For sensitive content, prefer offline tools. See are online PDF editors safe.

The reliable CLI recipe

For most batch jobs, this is the workflow:

# Sort images by filename so they appear in the right order
img2pdf $(ls -1v *.jpg) -o output.pdf

ls -1v does a "version-aware" sort, so image10.jpg comes after image9.jpg, not after image1.jpg.

For 100s of files spread across subfolders:

img2pdf $(find . -name "*.jpg" | sort -V) -o output.pdf

For one PDF per image:

for f in *.jpg; do
  img2pdf "$f" -o "${f%.jpg}.pdf"
done

For tens of thousands of files, parallelize with xargs -P or GNU parallel.

Why img2pdf is special

ImageMagick and many GUI tools recompress images during conversion. If your input is a JPEG, they decode it, then re-encode it as a (possibly different quality) JPEG inside the PDF. This loses quality and adds CPU time.

img2pdf is different: it wraps the original JPEG bytes inside a PDF page. No decode, no re-encode. The PDF page is the same JPEG, just inside a PDF container. Result: faster, smaller (often), and visually identical to the source.

This matters most for high-quality scans where you do not want extra compression artifacts.

Page size and orientation

A common pitfall: images in different resolutions become pages of different sizes in the PDF. Sometimes that is fine. For a uniform document, you want consistent page size.

img2pdf has page size options:

img2pdf *.jpg --pagesize A4 -o output.pdf

This fits each image onto an A4 page, scaling as needed. Add --fit into to control fit behavior:

  • --fit into, scale to fit page size, preserve aspect ratio (default for --pagesize)
  • --fit shrink, only shrink if larger than page; keep small images at native size
  • --fit fill, fill the page completely (may crop)
  • --fit exact, stretch to fill (rare; distorts)

For mixed-orientation images, img2pdf rotates pages automatically based on EXIF orientation, but you can override.

Adding OCR to make the result searchable

Image-to-PDF conversion produces a PDF with no selectable text. Recipients cannot search or copy from it.

To make it searchable, run OCR after conversion:

ocrmypdf input.pdf output.pdf

OCRmyPDF adds an invisible text layer. The visual is unchanged; the text is now selectable. For more, see PDF OCR explained and how to make a PDF searchable OCR.

For multi-language scans, OCRmyPDF accepts -l eng+spa+fra for combined language models. Tesseract has language packs for nearly any major language.

Compression strategies

Image-derived PDFs can be huge. Strategies to reduce size:

  • Pre-compress images before conversion. Use jpegoptim or mozjpeg on JPEGs to remove metadata and recompress losslessly. Use pngquant on PNGs.
  • Use lower-quality JPEG inputs if visual quality allows. A 1200x1600 image at 80% quality vs 95% can be 40% smaller with imperceptible difference.
  • Downsample resolution in img2pdf with --imgsize for specific output dimensions.
  • Post-process the PDF with Ghostscript: gs -dPDFSETTINGS=/ebook -sDEVICE=pdfwrite -o smaller.pdf bigger.pdf. See Ghostscript introduction and reduce PDF file size.

A typical 50-image PDF can shrink from 80 MB to 8 MB with sensible compression, with no visible loss.

Bookmarks and structure

A multi-page PDF without bookmarks is hard to navigate. After conversion, add bookmarks to mark sections:

  • Bookmark 1: "Receipts January"
  • Bookmark 2: "Receipts February"
  • Bookmark 3: "Notes"

Tools like pikepdf, qpdf, and most PDF editors support adding bookmarks via CLI or GUI.

For consistent metadata across batches, set the title, author, and subject after conversion. See how to edit PDF metadata.

Photographing instead of scanning

A common modern workflow is photographing documents with a phone instead of using a flatbed scanner.

Phone scanner apps (Apple Notes, Microsoft Lens, Google Drive Scan, Adobe Scan) do something useful: they detect document edges, deskew the image, and crop. The output is a clean rectangular page.

If you photograph manually without these helpers:

  • Hold the camera flat above the document
  • Light it evenly to avoid shadows
  • Use the highest resolution your phone supports
  • Run an image-processing step before conversion: deskew with ImageMagick (convert input.jpg -deskew 40% output.jpg), or use the open-source unpaper tool for full document cleanup
  • Apply auto-rotation based on text orientation, especially for casual photos

A 30-second cleanup pass transforms shaky phone photos into a professional-looking document.

Common gotchas

Image order is wrong. Alphabetical sorting differs from natural order: image10.jpg sorts before image2.jpg in default sort. Use ls -1v or sort -V for natural ordering.

Different resolutions cause page-size jumps. Specify --pagesize to normalize.

EXIF orientation tags ignored. img2pdf respects EXIF orientation by default; some other tools do not. The result is images that look rotated incorrectly in the PDF. Pre-rotate or use img2pdf.

Color profile mismatches. Photos with embedded ICC profiles may render slightly differently in the PDF if the renderer ignores profiles. For brand-critical content, strip profiles or embed the right one.

Hidden EXIF data. Phone photos carry GPS coordinates and timestamps in EXIF. Strip with exiftool -all= input.jpg before conversion if privacy matters. See how to strip metadata from PDF for the PDF-level concerns.

PNG transparency. PNGs with transparent backgrounds become PDF pages with weird transparency. Convert to JPEG first or specify a background color.

Specific use cases

Scanned contracts. Photos or scanner output of physical contracts. Use img2pdf for fidelity, then OCRmyPDF for searchability, then sign the result.

Receipt collections. Phone photos of receipts. Use a phone scanning app for cropping, then upload to img2pdf or your favorite tool for the bundle.

Product photo bundles. High-resolution photos for distribution. img2pdf preserves quality; compress with Ghostscript for delivery.

Portfolio. Photographer portfolios in PDF. See PDF for photographers' portfolios for additional polish (cover page, watermarks, metadata).

Takeaway

Batch-converting images to PDF is one of the cleanest jobs in the PDF ecosystem. img2pdf wraps original image bytes losslessly; ImageMagick covers more transforms; phone scanner apps clean up casual photos before conversion. Normalize page sizes for uniform output, run OCR if you want searchability, compress the result if file size matters. The end product is a single navigable document instead of a folder full of loose files. For follow-up steps like adding bookmarks, page numbers, or signing, Docento.app handles them in the browser.

Related Posts