# Image to Text OCR - Extract Text from Images & Scanned PDFs (`teddythebuilder/image-to-text-ocr`) Actor

Extract text from images and scanned PDFs in bulk with Tesseract OCR: screenshots, documents, receipts, posters. 12 languages, text with paragraphs, word count, confidence and optional line boxes. URLs, scanned PDF pages or another Actor's dataset. No external AI API.

- **URL**: https://apify.com/teddythebuilder/image-to-text-ocr.md
- **Developed by:** [Teddy Wasserman](https://apify.com/teddythebuilder) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.20 / 1,000 image ocrs

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does Image to Text OCR do?

Image to Text OCR **extracts the text from images and scanned PDFs in bulk**. Give it image URLs (screenshots, scanned documents, receipts, invoices, posters, slides, product photos), scanned PDF files, or the image URLs in another Actor's dataset, and get back the text of each image or page with paragraphs and line breaks, a word count, a confidence score and, if you want, every text line with its position.

It runs the open-source **Tesseract OCR engine** (Apache-2.0) inside the Actor: no Google, OpenAI or other external API, no API key, and your images are not sent to a third party. It reads 12 languages (English, German, French, Spanish, Italian, Portuguese, Dutch, Swedish, Norwegian, Danish, Finnish, Polish), alone or mixed.

### Why use Image to Text OCR?

- **Bulk OCR without an API key.** Hundreds of images in one run, priced per image. No Google Cloud Vision setup, no LLM token bills.
- **Scanned PDFs too.** Each PDF page is rendered at 200 DPI (configurable) and OCR'd, with the page number in the output.
- **Clean text.** Paragraphs and line breaks follow the layout of the image. Optional per-line confidence and bounding boxes in original image pixels.
- **Tuned for real images.** EXIF rotation, transparent PNGs, small screenshots (upscaled before OCR) and huge scans (downscaled) are handled for you. A "sparse" layout mode finds scattered text on photos and posters.
- **Chains with other Actors.** Pass a dataset ID and the field that holds the image URL, for example the `fileUrl` from the Bulk Image & File Downloader or `imageUrl` from a product scraper.
- **Private by design.** OCR happens inside the Actor run; only the image URLs you give are downloaded, and `robots.txt` is respected.

### What data can you extract?

| Field | Example | Description |
|---|---|---|
| `url` | `https://tesseract-ocr.github.io/tessdoc/images/eurotext.png` | Image or PDF URL |
| `fileType` | `png` / `pdf` | Image format, or `pdf` |
| `page` / `pageCount` | `2` / `6` | Page number and page count (PDFs; pageCount also for multi-frame TIFF/GIF) |
| `text` | `The (quick) [brown] {fox} jumps!\nOver the $43,456.78 <lazy> #90 dog…` | Recognised text, lines joined by `\n`, paragraphs by a blank line |
| `wordCount` / `lineCount` | `66` / `12` | Words and lines found |
| `meanConfidence` | `91.4` | Average word confidence (0-100) |
| `languages` | `["eng"]` | OCR languages used |
| `width` / `height` | `640` / `500` | Image size in pixels |
| `lines` | `[{"text": "The (quick) [brown] {fox} jumps!", "confidence": 96.1, "box": [65, 41, 450, 30]}]` | Optional: every line with confidence and box `[x, y, width, height]` |
| `processingSeconds` | `0.59` | OCR time for this image or page |
| `foundIn` | `url` / `dataset:fileUrl` | Where the URL came from |
| `error` | `http_404` / `not_an_image_or_pdf` / `blocked_by_robots_txt` | Why an item was skipped (free) |
| `scrapedAt` | `2026-10-28T21:12:40Z` | Processing time |

### How to use Image to Text OCR (step by step)

1. Click **Try for free**.
2. Paste **Image URLs** and/or **Scanned PDF URLs**, or pick a **Dataset** from another run and set its **URL field**.
3. Choose the **Languages** in your images (more languages are slower) and the **Page layout**: Auto for documents and screenshots, Sparse for photos and posters.
4. Optional: set **Min word confidence** to drop noise, switch on **Include lines with boxes**, and set **Max images / PDF pages**.
5. Click **Start**. Open the **Text** view or export to JSON, CSV or Excel.

### Input example

```json
{
  "imageUrls": [
    "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
  ],
  "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],
  "languages": ["eng", "deu"],
  "layout": "auto",
  "maxPdfPages": 6,
  "includeLines": false,
  "maxItems": 100
}
```

### Output example

```json
{
  "url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png",
  "foundIn": "url",
  "fileType": "png",
  "page": null,
  "pageCount": null,
  "languages": ["eng"],
  "text": "The (quick) [brown] {fox} jumps!\nOver the $43,456.78 <lazy> #90 dog\n& duck/goose, as 12.5% of E-mail\nfrom aspammer@website.com is spam.\nDer ,,schnelle” braune Fuchs springt\n…",
  "wordCount": 66,
  "lineCount": 12,
  "meanConfidence": 91.4,
  "width": 640,
  "height": 500,
  "processingSeconds": 0.59,
  "scrapedAt": "2026-10-28T21:12:40Z"
}
```

### How much does it cost?

Image to Text OCR uses pay-per-event pricing.

| Event | Price (Free plan) | When it is charged |
|---|---|---|
| Actor start | $0.0005 | Once per run |
| Image OCR | $0.004 ($4 per 1,000 images) | One image processed |
| PDF page OCR | $0.008 ($8 per 1,000 pages) | One PDF page processed |

Images that can't be downloaded, files that are not images or PDFs, files over the size limit and URLs blocked by `robots.txt` are **free**. An image is charged once OCR ran, even if it contains no text. Paid Apify plans get Store discounts (Bronze −15%, Silver −30%, Gold and up −45%).

Worked examples (Free plan prices):

- **500 app or website screenshots:** ≈ **$2.00**.
- **A 40-page scanned contract:** 40 × $0.008 ≈ **$0.32**.
- **5,000 product photos** from a scraper's dataset, to read labels and packaging text: ≈ **$20**.

A full page of dense text takes 10-25 seconds on the default 1 GB memory; a screenshot with a few lines takes well under a second (the sample image: 0.6 s). More memory gives the run more CPU, so it finishes faster at the same price.

### Use cases

- **Document digitisation.** Turn scanned letters, contracts, forms and archive PDFs into searchable text.
- **Receipts and invoices.** Pull the raw text of receipts for expense tools or bookkeeping (combine with your own parsing or an LLM for fields).
- **Screenshots and social images.** Read the text in screenshots, memes, slides and infographics for search, moderation or analytics.
- **E-commerce.** Read text on product photos and packaging: ingredients, model numbers, labels.
- **RAG and AI pipelines.** Feed text from image-only documents into vector databases and LLM agents.
- **Accessibility.** Draft alt texts and transcripts for images that contain text.

### Use with AI agents, MCP and the API

```bash
curl -X POST "https://api.apify.com/v2/acts/teddythebuilder~image-to-text-ocr/run-sync-get-dataset-items?token=<TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"imageUrls":["https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"],"languages":["eng"]}'
```

Python with `apify-client`:

```python
from apify_client import ApifyClient

client = ApifyClient("<TOKEN>")
run = client.actor("teddythebuilder/image-to-text-ocr").call(run_input={
    "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],
    "maxPdfPages": 3,
    "languages": ["eng"],
})
for page in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(page.get("page"), page.get("meanConfidence"), (page.get("text") or "")[:200])
```

**MCP:** available as a tool in the Apify MCP server (`https://mcp.apify.com`) for Claude, ChatGPT, Cursor and other MCP clients.

### Integrations

Send the text to Google Sheets, Airtable, Notion, a vector database, Slack, email, Make, Zapier, n8n or a webhook after each run.

### Data source and legality

The Actor downloads only the image and PDF URLs you provide (or that are in the dataset you choose) and runs OCR locally with Tesseract. It respects `robots.txt`, sends a clear user agent and does not log in or bypass any protection. No image is sent to an external AI or OCR service.

You are responsible for having the right to process the images (copyright, personal data). Text in images can contain personal data, for example names on receipts or ID documents; process such images only with a legal basis and delete the results when you no longer need them.

### FAQ

**How accurate is it?**
On clean screenshots and printed documents Tesseract is usually above 90% confidence per word (the sample above: 91.4). Photos with perspective, low light, handwriting or decorative fonts are much harder; use the Sparse layout and a minimum confidence, or a vision-language model for those.

**Does it read handwriting?**
Only neat block letters, and not reliably. Tesseract is built for printed text.

**My PDF already has selectable text. Should I use this?**
No: the [PDF Text Extractor](https://apify.com/teddythebuilder/pdf-text-extractor) reads the existing text layer faster, more exactly and for less money. Use OCR for scanned PDFs and PDFs that are images.

**Which languages can I use together?**
Any of the 12, e.g. `["eng", "swe"]` for Swedish documents with English terms. Each extra language makes OCR slower.

**What does "Sparse" layout do?**
It looks for text anywhere in the image without assuming columns or paragraphs, which works better for posters, photos, memes and UI screenshots with scattered labels.

**Multi-page TIFF or animated GIF?**
Only the first frame is read; `pageCount` shows how many frames the file has. Convert multi-page TIFFs to PDF to OCR every page.

**Are images stored?**
No. Images are downloaded into the run's memory, read and discarded. Only the text is saved in the dataset.

**Questions or bugs?**
Open an issue on the actor page. We reply within 24 hours. If the actor helps you, a rating on the Store page helps others find it.

### Related actors

- [PDF Text Extractor](https://apify.com/teddythebuilder/pdf-text-extractor): text and Markdown from PDFs that have a text layer, with RAG chunks.
- [Bulk Image & File Downloader](https://apify.com/teddythebuilder/bulk-file-downloader): download all images from web pages or a dataset, then OCR them here via the dataset input.
- [Website to Markdown](https://apify.com/teddythebuilder/website-to-markdown): clean Markdown text of web pages for LLMs.

### Changelog and support

- **1.0 (October 2026):** first release. Tesseract OCR for image URLs, scanned PDF pages and dataset inputs; 12 languages; layout modes; confidence filter; optional line boxes.

Questions or feature requests? Open an issue on the actor page. We reply within 24 hours.

# Actor input Schema

## `imageUrls` (type: `array`):

Images to read: PNG, JPG, WebP, GIF, BMP, TIFF. One URL per line.

## `pdfUrls` (type: `array`):

Scanned PDFs (or any PDF): each page is rendered and OCR'd. For PDFs that already contain selectable text, the PDF Text Extractor is cheaper.

## `datasetId` (type: `string`):

Read image/PDF URLs from another Apify dataset, e.g. the output of an image scraper or the Bulk Image & File Downloader (field fileUrl).

## `datasetUrlField` (type: `string`):

Field in the dataset items that holds the URL (or a list of URLs), e.g. imageUrl, fileUrl, url.

## `languages` (type: `array`):

Languages in the images. Pick all that occur; more languages are slower. English is the default.

## `layout` (type: `string`):

Auto works for documents and screenshots. Sparse finds scattered text (posters, product photos, memes). Single block for one paragraph, single line for banners and captions.

## `minWordConfidence` (type: `integer`):

Drop words Tesseract is less sure about, e.g. 40 to remove noise from photos. 0 = keep all words.

## `includeLines` (type: `boolean`):

Also return every text line with its confidence and bounding box \[x, y, width, height] in original image pixels.

## `maxItems` (type: `integer`):

Stop after this many images and PDF pages. You pay per image or page processed.

## `maxPdfPages` (type: `integer`):

OCR at most this many pages of each PDF (from the start). 0 = all pages.

## `pdfDpi` (type: `integer`):

200 is a good balance; use 300 for small print.

## `maxFileSizeMb` (type: `integer`):

Skip larger files (free).

## `maxConcurrency` (type: `integer`):

Images processed at the same time. Defaults to the number of CPU cores of the run (raise memory for more cores).

## Actor input object example

```json
{
  "imageUrls": [
    "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
  ],
  "pdfUrls": [],
  "datasetUrlField": "url",
  "languages": [
    "eng"
  ],
  "layout": "auto",
  "minWordConfidence": 0,
  "includeLines": false,
  "maxItems": 100,
  "maxPdfPages": 20,
  "pdfDpi": 200,
  "maxFileSizeMb": 30
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "imageUrls": [
        "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("teddythebuilder/image-to-text-ocr").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "imageUrls": ["https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"] }

# Run the Actor and wait for it to finish
run = client.actor("teddythebuilder/image-to-text-ocr").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "imageUrls": [
    "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
  ]
}' |
apify call teddythebuilder/image-to-text-ocr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,teddythebuilder/image-to-text-ocr"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/IHXgIAjxYOUUWWq1d/builds/TZtTrIHBajm64PRcX/openapi.json
