Combine Images into a PDF Losslessly with img2pdf

Merge JPG or PNG images into one PDF file with img2pdf — pixels are embedded untouched, so no quality is lost.

Linuximg2pdfimagespdfLow risk
Run img2pdf page1.jpg page2.jpg -o scan.pdf to combine your images into one PDF in the given order.

01Command

Command
$ img2pdf page1.jpg page2.jpg page3.jpg -o scan.pdf

02What it does

Unlike ImageMagick's convert, img2pdf embeds JPEG data directly into the PDF container instead of decoding and re-encoding it, so output size matches the images and quality is bit-identical. Images appear in the order you list them (use shell globs like *.jpg for a whole folder), and --pagesize A4 or --fit scales pages to a standard paper size. For PNG screenshots it converts to lossless Flate — still no quality loss.

03Risk

RiskLow risk
Requirementsimg2pdf (sudo apt install img2pdf / sudo dnf install img2pdf)
!Warning: Image order matters and img2pdf does not OCR or compress — huge photos make a huge PDF, so resize them first if you need a smaller file.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • img2pdf — lossless JPEG to PDF converter
    josch (GitHub) · vendor-doc · 2026-09-17
    Evidence: Documents lossless embedding of JPEG/JP2 images into PDF, page size options like --pagesize A4, and multiple input files.
  • img2pdf(1) — Debian manual page
    Debian · community · 2026-09-17
    Evidence: Reference for img2pdf options including -o output, --pagesize, and ordering of input images.

Last verified: 2026-09-18 · Category: Media