PDF to image conversion: DPI, quality, and practical tips
PDF-to-image conversion is driven by one number more than any other: DPI. Too low and text is illegible; too high and the file is uselessly large. The right DPI depends entirely on the output destination — screen, print, OCR, or archival. Everything else, including format and color mode, follows from that first decision.
Getting a clean image from a PDF is almost always about DPI discipline. Decide where the image will be used, map that to a DPI target, pick the format that handles the content type (PNG for text-heavy pages, JPEG for photo-heavy ones), and strip any color profile mismatch before it reaches the output. The tooling is secondary; poppler-utils and ImageMagick both do the job once the settings are right.
Why DPI is the central decision
A PDF page contains resolution-independent objects: vector text, vector paths, and embedded raster images. When you convert to a raster image format, the renderer must decide how many pixels to create per inch of page. That decision is DPI (dots per inch), and it determines everything else.
At 72 DPI, an A4 page (8.27 × 11.69 inches) renders to 595 × 842 pixels. At 300 DPI, the same page renders to 2480 × 3508 pixels — over 17 times as many pixels, roughly 17 times the file size before compression, and noticeably sharper text. At 600 DPI, you get 4960 × 7016 pixels — 70 times the 72 DPI pixel count.
The right DPI is not the highest DPI. OCR software works best between 300 and 400 DPI; beyond that, accuracy typically does not improve while processing time grows. Web display rarely benefits from above 150 DPI because CSS handles the display density independently. Print reproduction needs exactly 300 DPI at the intended print size, not more.
Choosing between PNG, JPEG, and WebP
PNG is the right format for pages dominated by text, tables, line art, and vector diagrams. Its lossless compression keeps characters crisp, and there are no JPEG-style artifacts around high-contrast edges. The cost is a larger file compared to JPEG on the same content.
JPEG works well for pages that are mostly photographs or complex continuous-tone artwork. The lossy compression hides well in smooth gradients and does not produce the blocky ringing around text that makes JPEG screenshots unreadable — but only because there is little text to ring around.
WebP lossless can replace PNG for most PDF-to-image pipelines and produces smaller files. WebP lossy, at quality 85 or above, is a viable JPEG alternative for photo-heavy pages. The limitation is tooling: not all downstream tools that accept images accept WebP, so verify the pipeline before committing to it.
Converting PDF pages with poppler-utils
- Install poppler-utils
On Debian/Ubuntu: `apt install poppler-utils`. On macOS with Homebrew: `brew install poppler`. On Windows, prebuilt binaries are available from the poppler Windows releases page.
- Convert all pages to PNG at 300 DPI
The command `pdftoppm -r 300 -png input.pdf output/page` renders every page and writes `output/page-1.png`, `output/page-2.png`, and so on. The `-r` flag sets DPI.
- Convert a single page range
Add `-f 3 -l 7` to render only pages 3 through 7: `pdftoppm -r 300 -png -f 3 -l 7 input.pdf output/page`. This is much faster than rendering the whole document when you only need a subset.
- Use JPEG for photo-heavy PDFs
Replace `-png` with `-jpeg -jpegopt quality=85` for JPEG output. The `jpegopt` argument accepts quality, progressive, and optimize flags. For photo-heavy annual reports or brochures, JPEG at 85 halves the output size compared to PNG.
DPI versus output size for a single A4 page
| DPI | Pixel dimensions | PNG size (approx.) | JPEG 85 size (approx.) |
|---|---|---|---|
| 72 | 595 × 842 | ~120 KB | ~40 KB |
| 96 | 794 × 1123 | ~200 KB | ~70 KB |
| 150 | 1240 × 1754 | ~450 KB | ~150 KB |
| 300 | 2480 × 3508 | ~1.5 MB | ~500 KB |
| 600 | 4960 × 7016 | ~5.5 MB | ~1.8 MB |
Color modes and ICC profile handling
PDF files can embed CMYK color spaces intended for print. Most image viewers and web browsers work in sRGB, so a CMYK PDF rendered without color conversion produces images with shifted, washed-out colors. When converting a print-production PDF, explicitly request an sRGB output profile.
With pdftoppm, add `-srgb` to force sRGB output regardless of the embedded color space. With ImageMagick, add `-colorspace sRGB` before the output path. If the conversion is for print reproduction, preserve the CMYK profile instead and confirm the target printer can accept CMYK images.
Grayscale PDFs — scanned documents, legal filings — can be rendered as grayscale images with `-gray` (pdftoppm) or `-colorspace Gray` (ImageMagick). Grayscale files are roughly one-third the size of their RGB equivalents at the same DPI.
Tips for batch PDF-to-image jobs
- Use pdftoppm for batch work — it is faster than ImageMagick for PDFs because it does not go through Ghostscript.
- Split very large PDFs into chunks with `pdfseparate` before converting; this allows parallel processing.
- Name output files with zero-padded page numbers (`page-%04d.png`) so they sort correctly in filesystems.
- Verify a sample page at the chosen DPI before running the full batch — a 300-DPI mistake on a 1000-page document wastes significant time.
- For archival scans destined for long-term storage, TIFF with LZW compression preserves metadata and is more archivally accepted than PNG or JPEG.
Frequently asked questions
- What DPI should I use to convert a PDF to an image?
- It depends on the end use: 150 DPI for screen display, 300 DPI for print or OCR, and 400–600 DPI for archival preservation. Going above 300 DPI for screen use wastes storage and does not improve readability.
- Why does my PDF look blurry when converted to an image?
- The DPI setting is too low. A common mistake is accepting the default 72 DPI. For readable text, set DPI to at least 150 for screen use or 300 for print and OCR.
- Should I use PNG or JPEG when converting a PDF?
- PNG for text-heavy pages, JPEG for pages dominated by photographs. PNG keeps text crisp and artifact-free; JPEG handles smooth photographic content efficiently but blurs fine text.
- How do I convert only specific pages from a PDF?
- With pdftoppm, use `-f` and `-l` flags for the first and last page: `pdftoppm -r 300 -png -f 2 -l 5 input.pdf output/page`. This is much faster than converting the entire document when only a subset is needed.
- Why are colors wrong in my PDF-to-image conversion?
- The PDF likely uses a CMYK color space intended for print, but the converter is outputting to sRGB without a profile conversion. Add `-srgb` (pdftoppm) or `-colorspace sRGB` (ImageMagick) to correct the color mapping.