New Tool Radar

OCR & Text Layers

How to OCR a Single-Column Scan with Tesseract Page Segmentation Mode 4

Use Tesseract's single-column page segmentation mode on a one-column scan, and check the text comes out in reading order.

Schematic illustration of Tesseract page segmentation mode 4: a single-column report reads in order and the word harvest is found once.

Tesseract’s –psm option tells the engine what layout to assume. The manual lists mode 4 as assuming a single column of text of variable sizes, which is the right assumption for a plain one-column letter — and the wrong one for a newspaper.

Use the practice file

A practice document, practice-single-column.pdf. The file is fictional.

Page Content
1 Single-column letter, 14 lines
2 Single-column report, 20 lines, including the word “harvest”
3 Single-column notes, 6 lines

Page 2 is the check page: the word “harvest” appears there once.

Check mode 4 on a single column

Expected result. We checked the OCRmyPDF manual and the Tesseract manual. We did not run any tool. The checks below are what to expect if the work is done correctly; run them yourself on the practice file.

1. Run Tesseract with –psm 4

Run tesseract page2.png out –psm 4 on a render of page 2.

Expected result: Tesseract produces a text file for the page.

2. Read the output in order

Open the text file and read it top to bottom.

Expected result: The 20 lines appear in page order, with no line repeated or missing.

3. Search the output

Search the text file for “harvest”.

Expected result: 1 hit, matching the visible word on page 2.

4. Compare with the default mode

Run the same page with –psm 3 and compare the two outputs.

Expected result: Both read correctly here; mode 4 is chosen for its explicit assumption, not because the default failed.

Verdict table

Check Expected result Pass?
Run Tesseract with –psm 4 Tesseract produces a text file for the page. —
Read the output in order The 20 lines appear in page order, with no line repeated or missing. —
Search the output 1 hit, matching the visible word on page 2. —
Compare with the default mode Both read correctly here; mode 4 is chosen for its explicit assumption, not because the default failed. —

Related guides: How to Batch OCR a Multi-Page PDF with Consistent Settings — How to Add a Searchable Text Layer to a Scanned PDF.

Limits

  • A page segmentation mode is an assumption about layout, not a quality setting: the right mode matches the page in front of you.
  • Command-line OCR rewrites the file, so always work on a copy and keep the original scan untouched.
  • UNTESTED — no OCR tool was run; all results above are expected results. The practice file is fictional.

Sources

See all