Skip to main content

PDFs

JPEG, PNG, and PDF default to lossless tools.

Lossless​

Install filerepack[pdf] so pikepdf can walk embedded JPEG / JPEG 2000 / Flate image streams. Lossless acceptance also requires qpdf 11+ for independent object/decoded-stream comparison. Filerepack compares the original, walked and qpdf candidates and selects the smallest verified result. Without pikepdf, only qpdf candidates are available.

pip install 'filerepack[pdf]'
filerepack repack report.pdf

Encrypted, digitally signed, and protection-uncertain PDFs skip all rewriting, including qpdf and Ghostscript. Eligible image streams keep their host color, decode, mask, dimensions and depth attributes; unsupported sample layouts stay unchanged.

DCT comparison supports decoded 8-bit Gray/RGB/CMYK. JPX comparison checks the encoded component precision and color/channel fields and currently supports unsigned unsampled 8-bit components. High-depth, signed and subsampled JPX profiles remain unavailable. A PDF dictionary claiming 8 bits cannot authorize an intrinsically higher-depth stream. PNG-predictor/Flate profiles have separate sample checks, including the qualified 16-bit gray fixtures.

Adobe Illustrator .ai uses the same path when the file is a PDF wrapper.

Lossy (scans)​

--lossy uses Ghostscript /ebook (150 dpi) so scanned pages actually shrink. --pdf-profile prepress restores print-quality Ghostscript. --jpeg-quality sets Distiller QFactor for images inside PDFs.

filerepack repack scan.pdf --lossy
filerepack repack scan.pdf --pdf-profile printer --jpeg-quality 75
filerepack repack scan.pdf --pdf-profile prepress

--lossy / --pdf-profile / --jpeg-quality skip pikepdf and use Ghostscript instead.

Ghostscript Distiller presets: screen, ebook, printer, prepress, default.