Extract Text from Images with tesseract OCR

Turn screenshots, photos, and scans into editable text with the free offline Tesseract OCR engine on Linux.

LinuximagestesseractocrLow risk
Run tesseract screenshot.png output -l eng to OCR the image into output.txt.

01Command

Command
$ tesseract screenshot.png output -l eng --psm 3

02What it does

Tesseract reads the image and writes recognized text to output.txt (the extension is added automatically). The -l flag picks the language — install packs like tesseract-ocr-chi-sim for Simplified Chinese and combine them as -l chi_sim+eng. --psm controls page segmentation: the default 3 suits full pages, while 6 (uniform block) or 7 (single line) help with cropped screenshots. Accuracy improves a lot on clean, high-contrast images — preprocessing with ImageMagick (convert in.png -colorspace Gray -resize 300% out.png) helps blurry shots.

03Risk

RiskLow risk
Requirementstesseract-ocr (sudo apt install tesseract-ocr; add language packs like tesseract-ocr-chi-sim)
!Warning: OCR is never perfect: always proofread names, numbers, and code-like text, especially for handwriting, stylized fonts, or low-resolution photos.

04Undo

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

05Sources

  • tesseract(1) — Ubuntu manual page
    Canonical · community · 2026-09-17
    Evidence: Documents tesseract imagename outputbase [-l lang] [--psm pagesegmode] for OCR of image files.
  • tesseract-ocr/tesseract — GitHub
    Google / open source · vendor-doc · 2026-09-17
    Evidence: Official repository describing supported languages, language data installation, and page segmentation modes.

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