Image & PDF to Text OCR: Tesseract for Screenshots, Receipts avatar

Image & PDF to Text OCR: Tesseract for Screenshots, Receipts

Pricing

Pay per event

Go to Apify Store
Image & PDF to Text OCR: Tesseract for Screenshots, Receipts

Image & PDF to Text OCR: Tesseract for Screenshots, Receipts

Image to text and PDF to text OCR with Tesseract: extract text from images, screenshots, receipts, invoices and scanned PDFs in bulk, in 44 languages including Chinese, Japanese and Arabic. Plain text, word boxes, hOCR or TSV. Failed files are free.

Pricing

Pay per event

Rating

0.0

(0)

Developer

SiteAcs

SiteAcs

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Features

Limited permissions

Share

Extract the text from images, screenshots, receipts, invoices and PDFs with Tesseract OCR, in bulk and in 44 languages (Chinese, Japanese, Korean, Arabic, Hindi and Russian among them). Give it image or PDF URLs, records in an Apify key-value store, or a URL field of a dataset; get one row per image or PDF page with the text, Tesseract's meanConfidence (0-100) and the wordCount, and on request every word with its box (words), hOCR or TSV.

  • $2.50 per 1,000 images or scanned PDF pages read by OCR; $0.50 per 1,000 PDF pages that already contain text (taken from the PDF itself, no OCR). Files that fail to download, are not images, are too large or cannot be read are free.
  • Read inside the run: Tesseract 5.5 runs in the actor's container. Your files go to no other OCR service and are not kept after the run.
  • Preprocessing built in: pages on their side or upside down are turned, tilted scans straightened, small screenshots enlarged, light text on dark backgrounds inverted, and a page that reads badly gets a second pass.

Quick start: paste the file links into "Image or PDF URLs" and pick the languages printed in them.

{
"imageUrls": ["https://upload.wikimedia.org/wikipedia/commons/f/f1/Arco_3076_receipt_%282003-09-16%29.jpg"],
"languages": ["eng"],
"pageSegmentationMode": "single_column"
}

With other actors: point "Dataset" at a scraper's run and "Dataset field" at its image URLs, for example image from Amazon Best Sellers Scraper or AliExpress Search Scraper (text on product images), or thumbnailUrl from YouTube Video Details (text on thumbnails). For the speech in videos, use YouTube Transcript Scraper or TikTok Transcript Scraper instead.

What inputs work well (measured)

We ran the actor on Apify over 198 images whose true text we know (results from build 0.1.6), and report the character error rate (CER): the share of characters wrong, missing or extra against the true text (lower is better; 1% is about one wrong character in a 100-character line). 180 of the images were generated for the test (text drawn in 13 common fonts, then blurred, tilted, compressed or faded to look like scans and screenshots); 18 are real photos and scans of receipts and signs from Wikimedia Commons, transcribed by hand.

InputImagesCERSettings
Clean document text, 12-48 px350.10%defaults
Scanned pages (blur, noise, slight tilt, JPEG)300.65%defaults
Pages on their side, upside down or tilted 3-8°200.05%defaults
Faint or low-contrast text202.14%defaults
Web and app screenshots, light and dark253.14%defaults
Printed receipts103.41%Layout "Single column" (15.99% with Automatic)
Portuguese, Spanish, German, French pages240.00-0.09%that language selected
Chinese (simplified), Japanese pages161.51%, 0.43%that language selected
Real photos and scans of receipts and signs1826.7%defaults

On our generated pages, printed text on a flat page or a screen reads well: under one wrong character per hundred on documents and scans, about three per hundred on screenshots, and on receipts with Layout "Single column" (about 16 per hundred with the default layout). Real photos are much harder. About one character in four was wrong across our 18 transcribed real images: flat scans of real receipts came out at under 1% to 16%; phone photos of signs and receipts, with curved paper, glare, small text in a big scene or decorative fonts, at 17% up to nothing readable. We also ran 278 more real Wikimedia Commons images with no transcription (bills, menus, notice boards, labels, at 1,280 px): 63 of them (23%) came back with no text at all, and 99 more read with a mean confidence under 60. A page read with no text found is still charged, so try a few of your own photos before a large run. For photos, crop to the text, keep the text at least 20 pixels high, and check the result before you rely on it. Handwriting is not supported: Tesseract reads printed text. These figures are from our test images; your own files may read better or worse.

Input

FieldWhat it does
Image or PDF URLsLinks to the files themselves: PNG, JPEG, WebP, GIF, BMP, TIFF (every page), HEIC/HEIF from iPhones, AVIF, PDF.
Key-value storeRead images saved in an Apify key-value store, all of them or only some keys or a key prefix.
Dataset + Dataset fieldRead the image URLs in a field of a dataset, e.g. imageUrl, images (a list) or images.url (nested).
LanguagesEvery language printed in the images (up to 5). English, Portuguese, Spanish, German, French, Italian, Dutch, Polish, Russian, Arabic, Hindi, Chinese, Japanese, Korean and 30 more.
LayoutTesseract's page segmentation mode. Automatic for pages, scans and screenshots; Single column for receipts and invoices (prices stay on their item's line); Sparse for signs and labels.
PreprocessingOrientation fix, straightening, enlarging small images, contrast stretch, second pass for poor pages, black-and-white method, a character whitelist (e.g. digits only).
OutputAdd words with boxes and confidence, hOCR, or TSV.
PDF text layerAutomatic (default): a PDF page that already has real text is taken from the PDF (the text the page shows) and charged as a cheap Text page; scanned pages are read by OCR. Always OCR reads every page as an image.
LimitsMaximum files, pages per PDF or TIFF (20, from the first; the run's status says how many pages past it were not read), PDF resolution (200 DPI), largest file (50 MB), largest image (60 megapixels). Pages over 5,000 px on their longer side are shrunk to 5,000 px before reading.

Example input (a receipt, with every word and its box):

{
"imageUrls": ["https://upload.wikimedia.org/wikipedia/commons/f/f1/Arco_3076_receipt_%282003-09-16%29.jpg"],
"languages": ["eng"],
"pageSegmentationMode": "single_column",
"includeWords": true
}

Output

One row per image, and one per PDF or TIFF page:

{
"index": 0,
"source": "https://upload.wikimedia.org/wikipedia/commons/f/f1/Arco_3076_receipt_%282003-09-16%29.jpg",
"page": null,
"pageCount": null,
"ok": true,
"charged": true,
"method": "ocr",
"language": "eng",
"text": "PSI #3076\n1935 E Katella Ave\nOrange, CA 92668\n\nInvoice # 938870\nDate 09/16/03\n...\nTotal Sale $26.54\n...",
"meanConfidence": 80.8,
"wordCount": 55,
"lineCount": 22,
"processingMs": 334,
"imageWidth": 676,
"imageHeight": 1812,
"rotation": 0,
"preprocessing": [],
"contentType": "image/jpeg",
"fileBytes": 976574,
"words": [{"text": "PSI", "confidence": 89.3, "left": 239, "top": 194, "width": 65, "height": 46,
"block": 1, "paragraph": 1, "line": 1}],
"hocr": null,
"tsv": null,
"errorType": null,
"error": null
}
  • method is ocr when Tesseract read the image or page, and text-layer when the PDF page's own text was used (then meanConfidence, language, imageWidth and imageHeight are null, words, hocr and tsv are not given, processingMs is the time taken to read the text layer, and the page is charged as a Text page). It is null on failed files.
  • page and pageCount are the page number (from 1) and the file's page count for PDFs and multi-page TIFFs, null for a single image.
  • meanConfidence is Tesseract's own 0-100 score averaged over the words. Below 60 usually means a poor read.
  • rotation is how far the page was turned before reading (90, 180, 270, or a few degrees of straightening). Word boxes are in pixels of the page as read, after that turn and after shrinking a page over 5,000 px; imageWidth and imageHeight give that frame.
  • preprocessing lists what was done: inverted, contrast, deskewed, upscaled, rotated, smoothed.
  • Failed files have ok: false, charged: false, an errorType (dns, connect, timeout, tls, http, blocked_address, too_large, unreadable, not_found, invalid_url, download, ocr_failed, cost_limit, other) and the error in words. When the maximum cost per run is reached, every file not read gets a free cost_limit row.
  • Reading a whole key-value store skips its JSON and text records (no row); name keys to read only those.

Pricing

Two events, charged per row saved:

EventPriceWhen
Image$2.50 per 1,000 ($0.0025)an image, or a PDF or TIFF page, read by OCR
Text page$0.50 per 1,000 ($0.0005)a PDF page whose own text was used (method is text-layer)

A page read by OCR with no text found still counts, because it was read; anything that could not be read is free. Set a maximum cost per run in Apify and the actor stops there (a Text page counts a fifth of an image against it).

How a PDF page is chosen (PDF text layer "Automatic"): only text a reader of the page can see is taken: text outside the visible page (crop box), white text on a white background and invisible text not over a picture are left out. The page's text is used when that leaves at least 50 non-blank characters, at most 5% of them broken (unmapped glyphs, control characters) and at least half letters or digits (dot leaders, form lines and rules count once). Otherwise the page is rendered and read by OCR, at the Image price. So these are read as images:

  • a page that is mostly a picture (a scan, a screenshot, a slide built around a picture) with only a line or two of text of its own (under 300 characters), such as a court filing header, a DocuSign envelope id or a "Confidential" footer stamped on a scan: the page body is in the picture. A scan whose picture is covered by an invisible OCR text layer is the exception: that layer is used (with the stamp), as a text page. A page with more text than that over a big picture (a letter on a letterhead image, a brochure page with a large photo, a dark-theme slide) is a text page, and text inside its picture is not read: choose Always OCR for that;
  • a PDF with unreadable fonts, and a page of drawings;
  • text in the wrong code page: letters that come out as Latin when every language you chose is written in another script (Russian saved as Windows-1252, Hindi in a legacy Kruti Dev font), or mostly accented Latin-1 letters.

A page whose text layer holds more than 500,000 characters (far beyond any real page) gets a free too_large row; the other pages of the file are read. Words with boxes, hOCR, TSV and "Only these characters" are OCR output: with any of them on, every page is read by OCR.

Tips

  • PDFs that already contain text (exported from Word, invoices from billing systems) are read from the PDF itself at $0.50 per 1,000 pages; scanned pages in the same file are read by OCR, page by page. Text comes out in the order the PDF stores it, so multi-column pages and tables may need your own tidying.
  • Set "PDF text layer" to Always OCR when the PDF's own text cannot be trusted: a scan carrying an old, poor OCR layer (that text is passed on as it is, errors included: "Tbe qu1ck brovvn f0x"), text in a wrong code page that the checks above miss (for example with English chosen alongside), or a page whose stamp the rules above take for its text. Every page is then rendered and read by Tesseract, at the Image price.
  • Receipts and invoices: Layout "Single column" keeps each price on its item's line.
  • Numbers only: "Only these characters" 0123456789.,- for meters, price tags and codes.
  • Mixed languages: pick all of them, for example English + Spanish; each extra language makes reading slower.
  • Screenshots of apps: white text on coloured buttons and bars is often missed; the rest of the screen reads well.
  • Speed: one Tesseract process runs per CPU core, and Apify gives one core per 4 GB of memory. More memory reads faster at the same cost per image.

Other languages

  • Português: OCR de imagens para texto com Tesseract: extraia texto de imagens, capturas de tela, recibos, notas fiscais e PDFs digitalizados, em português e mais 43 idiomas. US$ 2,50 por 1.000 imagens (US$ 0,50 por 1.000 páginas de PDF que já têm texto); arquivos com erro são gratuitos.
  • Español: OCR de imagen a texto con Tesseract: extrae el texto de imágenes, capturas de pantalla, tickets, facturas y PDF escaneados, en español y 43 idiomas más. 2,50 USD por 1.000 imágenes (0,50 USD por 1.000 páginas de PDF que ya tienen texto); los archivos con error son gratis.
  • Français : OCR d'image en texte avec Tesseract : extrayez le texte d'images, de captures d'écran, de tickets, de factures et de PDF scannés, en français et 43 autres langues. 2,50 USD pour 1 000 images (0,50 USD pour 1 000 pages de PDF qui contiennent déjà du texte) ; les fichiers en erreur sont gratuits.
  • Deutsch: Texterkennung (OCR) mit Tesseract: Text aus Bildern, Screenshots, Kassenbons, Rechnungen und gescannten PDFs extrahieren, auf Deutsch und in 43 weiteren Sprachen. 2,50 USD pro 1.000 Bilder (0,50 USD pro 1.000 PDF-Seiten, die schon Text enthalten); fehlerhafte Dateien sind kostenlos.

Limits and privacy

  • Printed text only; no handwriting, no table structure (use the word boxes to rebuild columns).
  • Only public http(s) addresses are fetched: private and internal addresses are refused, including after redirects.
  • Images over the pixel limit are refused from their header, before they are decoded, and PDF pages holding an embedded image over the limit are refused before they are rendered.
  • The images are read inside the run and not stored; the text is in your dataset.