Skip to main content
Glama

Extract text from images (OCR)

extract_text_from_image
Read-only

Extract readable text from images, screenshots, photos, and scanned PDFs via OCR. Returns reading-order text with confidence and optional bounding boxes for receipts, invoices, and forms.

Instructions

OCR: extract the text from images, screenshots, photos and scanned PDFs reachable by URL (PNG, JPG, WEBP, TIFF, BMP, GIF, HEIC, PDF). Returns reading-order text per image or PDF page with an average confidence, and optionally every line with its pixel bounding box. Reads English and other Latin-script languages, Chinese and Japanese; PDFs that already contain a text layer are read exactly without OCR. Use it for receipts, invoices, forms, scanned documents, screenshots and product photos when you need the words in the image, not a description of it. For digital (non-scanned) PDFs and Office files prefer convert_document_to_markdown. Cost: $0.003 per image or PDF page read ($0.008 with quality "accurate"), billed to your Apify account; failed downloads and pages with no text are free. Runs the Apify actor kantolabs/image-to-text-ocr with your APIFY_TOKEN; maxTotalChargeUsd caps the spend per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pdfDpiNoRender resolution for scanned PDF pages. Default 200; use 300 for small print.
pdfModeNo"auto" (default) uses a PDF page's own text layer when present and OCRs only scanned pages; "ocr" always runs OCR.
qualityNo"fast" (default, $0.003/page) is right for screenshots, documents and Latin-script text. "accurate" ($0.008/page, about 4x slower) is better for Japanese, dense Chinese, stylized fonts and poor photos.
sourcesYesDirect links to images or PDF files, e.g. ["https://example.com/receipt.jpg", "https://example.com/scan.pdf"]. Each image and each PDF page is one charged result.
maxPdfPagesNoRead only the first N pages of each PDF (each page is charged). Default 50.
timeoutSecsNoGive up after this many seconds (max 300, Apify's limit for synchronous runs). Default 280. For big batches, split the input into several calls.
includeLinesNoAlso return every text line with its confidence and pixel box [x0, y0, x1, y1] (much larger output; useful for tables or finding a value next to a label). Default false.
minConfidenceNoDrop text lines recognized below this confidence. Default "0.5"; use "0.3" for very poor scans.
maxTotalChargeUsdNoHard spending cap for this call in USD, enforced by Apify: the run stops once it has charged this much. Default 1 (server setting KANTO_MAX_CHARGE_USD).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark readOnlyHint=true, but the description adds substantial behavior beyond that: it runs an Apify actor, requires APIFY_TOKEN, has per-page billing, enforces a spending cap, and treats PDFs with text layers differently. It even notes failed downloads and empty pages are free. No contradiction with annotations; this is rich, honest disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but densely informative, front-loaded with the core function before cost and backend details. Every sentence earns its place—formats, languages, alternatives, billing, and token usage are all relevant. It is structured logically, though a touch verbose for agents that prefer brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description explains the return value ('reading-order text per image or PDF page with an average confidence, and optionally every line with its pixel bounding box'). It covers cost, failure cases, input limits, and batching advice, making it fully sufficient for an agent to call the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so each parameter has a basic description. The tool description adds meaningful context: it ties quality to cost, explains that each image/PDF page is one charged result, clarifies pdfMode behavior, and warns about output size for includeLines. This goes beyond the schema without duplicating it, though it doesn't explicitly walk through every parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb ('extract the text'), a clear resource (images, screenshots, photos, scanned PDFs), and the exact return (reading-order text with confidence, optional bounding boxes). It also names the sibling it is not ('For digital (non-scanned) PDFs and Office files prefer convert_document_to_markdown'), so an agent can distinguish it from similar tools immediately.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use it ('receipts, invoices, forms, scanned documents, screenshots and product photos') and when not to ('digital (non-scanned) PDFs and Office files'), naming the alternative tool. It also adds practical guidance on cost and batching, leaving no ambiguity about selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.