New Tool Radar

AI PDF

How to Check the DPI of Scanned Images in a PDF Before Running OCR

Run pdfimages -list to read the rendered ppi of each scanned page, so you know whether OCR will have enough detail to read the text.

Schematic with three steps: List the images with their rendered resolution; Compare each page with the OCR minimum; Rescan or upscale the weak pages before.

OCR accuracy depends on how many pixels describe each character. A scan rendered at 100 ppi gives the recognizer too little detail, while 300 ppi is a common working minimum. Checking the rendered resolution before OCR tells you whether to rescan or proceed.

What you need

  • poppler-utils installed, which provides pdfimages
  • A scanned PDF
  • A terminal

Step 1: List the images with their rendered resolution

Run pdfimages -list file.pdf and read the x-ppi and y-ppi columns, which give the resolution of each image as rendered on its page.

Step 2: Compare each page with the OCR minimum

Mark every page whose rendered resolution falls below the minimum you need, usually around 300 ppi for body text, and note the worst pages.

Step 3: Rescan or upscale the weak pages before OCR

Rescan the weak pages at a higher resolution, or use OCRmyPDF’s oversample option to raise the effective resolution, then re-list the images to confirm the fix.

Worked example: synthetic DPI check on a 12-page scan

The table below is a synthetic example. It shows the expected result of the pdfimages listing; no listing was run.

Page Rendered ppi OCR ready
Page 1 300 x 300 Yes
Page 5 150 x 150 No, too low
Page 9 300 x 300 Yes
Total 12 pages 1 page to rescan

Expected result (UNTESTED). most pages render at 300 ppi, but page 5 renders at 150 ppi and must be rescanned before OCR will read it reliably. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • pdfimages reports the resolution as rendered on the page, which depends on the placed size of the image.
  • A high ppi does not guarantee clean OCR if the scan is skewed, faint, or noisy.
  • Oversampling a low-resolution scan cannot add detail that was never captured.

Sources

See all