# Image to Text OCR: Bulk Images to Text and Markdown (`greenrun/image-to-text-ocr`) Actor

Extract text from images (PNG, JPEG, TIFF, WebP) with Tesseract OCR. Returns plain text, Markdown and lines with position and confidence. Images you provide only, nothing else is collected. Unreadable files and failed downloads are free.

- **URL**: https://apify.com/greenrun/image-to-text-ocr.md
- **Developed by:** [Greenrun](https://apify.com/greenrun) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 images

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Image to Text OCR: Bulk Images to Text and Markdown

Extract text from images (PNG, JPEG, TIFF, WebP) with Tesseract OCR. Returns plain text, Markdown and lines with position and confidence. Images you provide only, nothing else is collected. Unreadable files and failed downloads are free.

Give it image links (or `data:` URIs, or a field of a dataset) and get **the text of every image as plain text and Markdown, with every line's position and confidence**, in **123 languages**. Screenshots, scanned pages, receipts, slides, labels and multi-page TIFF scans all work. **You pay for images that were read with OCR; unsupported files, blocked links and failed downloads are free**, with the reason in the row. Made for document pipelines, RAG ingestion and AI agents that need to read what is inside an image.

### What it does

- **Reads text** with Tesseract 5 (LSTM models) from PNG, JPEG, TIFF (every page of a multi-page TIFF), WebP, GIF, BMP and JPEG 2000.
- **Returns three shapes**: `text` (lines in reading order, paragraphs separated by a blank line), `markdown` (paragraphs, large lines as `##` headings, bullet lists, hyphenated words joined) and `lines` with a bounding box in pixels of the original image and a confidence from 0 to 100; `words` on request.
- **Speaks 123 languages**: English, Polish, German, French, Spanish, Italian, Portuguese and Dutch are installed; Chinese, Japanese, Korean, Arabic, Hebrew, Hindi, Russian, Ukrainian and every other Tesseract language are downloaded at the start of the run.
- **Prepares images**: fixes EXIF rotation, puts transparent images on white, scales large photos down to 2,500 px and small screenshots up 2x before OCR.
- **Reads links from a dataset** (`images`, `images.url`, `product.imageUrl` ...) and accepts `data:image/...;base64` URIs, handy for AI agents.

### Why use it

- **Pay only for images read.** A PDF sent by mistake, a 404, a damaged file or a site that refuses access cost nothing, and each says why in `error`.
- **Layout you can use.** Bounding boxes and confidence per line let you find totals on receipts, crop regions, or drop low-confidence lines; Markdown keeps headings and lists for LLMs.
- **Any language, one input field.** Type `jpn`, `ara+eng` or `ukr`; no extra Actor, no API key.
- **Respectful.** robots.txt is checked for every image link and redirect, private network addresses are refused. No proxies, no CAPTCHA solving, no login. Only the images you give are read.
- **Built for AI agents.** Clear status messages, a predictable price per image, and limited permissions, so it works as a tool in the Apify MCP server.

### How to use

#### In Apify Console

1. Paste image links into **Image URLs**, one per line, or pick a dataset in **Image URLs from a dataset** and type the field with the links.
2. Set **Languages**, for example `eng+deu` or `jpn`.
3. For photos of labels, signs or packaging, choose **Layout: Sparse text**.
4. Press **Start**. The **Overview** shows the text of each image; the **Markdown** view shows the Markdown.

#### From an AI agent (MCP)

Connect any MCP client to the Apify MCP server with only this Actor as a tool:

```
https://mcp.apify.com?tools=greenrun/image-to-text-ocr
```

#### Through the API

```bash
curl -X POST "https://api.apify.com/v2/acts/greenrun~image-to-text-ocr/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"], "languages": "eng"}'
```

### Input

| Field | Default | Description |
|---|---|---|
| `urls` | | Image links (http, https or `data:` URIs), one per line. `index` keeps the input order. |
| `datasetId` | | Optional dataset whose items contain image links. |
| `datasetField` | `url` | Field with the links in each dataset item; dot paths and lists work. |
| `languages` | `eng` | Tesseract language codes joined with `+`, for example `eng+deu`, `chi_sim`, `jpn`, `ara`. |
| `pageSegmentation` | `auto` | Layout: `auto`, `sparse` (photos, labels), `singleBlock`, `singleColumn`, `singleLine`. |
| `includeLines` | `true` | Lines with bounding box and confidence. |
| `includeWords` | `false` | Words with bounding box and confidence. |
| `maxImageSide` | `2500` | Larger images are scaled down to this longer side before OCR (500-4000). |
| `maxPages` | `20` | Pages read from one multi-page TIFF (1-500). |
| `maxFileSizeMb` | `30` | Larger images are skipped for free (1-200). |
| `maxConcurrency` | `4` | Images downloaded at the same time (1-20). |
| `timeoutSecs` | `120` | Time limit for one image or TIFF page (10-1800). |

### Output

One row from a run on the Apify platform on 19 November 2026 (6 inputs; `lines` shortened to 2 of 13):

```json
{
  "index": 1,
  "input": "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
  "status": "text",
  "url": "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
  "finalUrl": "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
  "httpStatus": 200,
  "format": "png",
  "width": 640,
  "height": 500,
  "pages": 1,
  "pageCount": 1,
  "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.\n...",
  "markdown": "The (quick) [brown] {fox} jumps! Over the $43,456.78 <lazy> #90 dog & duck/goose, as 12.5% of E-mail from aspammer@website.com is spam. ...",
  "confidence": 91.7,
  "wordCount": 66,
  "characters": 414,
  "lines": [
    {"text": "The (quick) [brown] {fox} jumps!", "confidence": 95.8, "bbox": {"x": 65, "y": 41, "width": 450, "height": 30}, "page": 1},
    {"text": "Over the $43,456.78 <lazy> #90 dog", "confidence": 94.3, "bbox": {"x": 65, "y": 72, "width": 490, "height": 31}, "page": 1}
  ],
  "words": null,
  "scale": 2,
  "processingMs": 674,
  "warnings": [],
  "checkedAt": "2026-11-19T19:44:38Z",
  "error": null,
  "billableEvents": {"image": 1}
}
```

The same run answered `no_text` for the Python logo and for a photo of dice, `unsupported` for a PDF (with a pointer to Document to Markdown) and `not_found` for a missing image; the two `no_text` rows are charged since 0.2 (the OCR ran), the other two are free. A run with `"languages": "hin+heb"` downloaded both models and read a Hindi and a Hebrew test image in 5.8 seconds.

`status` is `text` or `no_text` (charged: the OCR ran), or one of the free statuses: `unsupported`, `not_found`, `blocked`, `too_large`, `error` (an `error` after the OCR started keeps its events). `confidence` is the mean word confidence (0-100); `scale` is the factor used for OCR. The `RUN-REPORT` record in the key-value store has the counts and the reason for every free row.

### Pricing

Pay per event, no subscription:

| Event | Price | When |
|---|---|---|
| Actor start | $0.0045 per GB of memory | Once per run: $0.009 at the default 2 GB. |
| Image | $0.002 | An image read with OCR, with or without text found, charged when its OCR starts. Each TIFF page, large images and slow OCR count more Images (below). |

**How Images are counted.** An image counts the largest of three numbers: its pages OCR'd (each page of a multi-page TIFF is at least one Image), its started 12 MP OCR'd (after `maxImageSide`: at the default 2500 px always one, at 4000 px a square image is two) and its started 16 GB-seconds of work (download, preparation and OCR: 8 seconds at the default 2 GB, 2 s at 8 GB; the run time is shared equally between the images in progress, not while an image waits for the OCR). Most screenshots and scans are one Image; dense pages, several languages and more memory make images count more. Each row shows its count in `billableEvents`, its work in `workGbSecs` and its pixels in `megapixelsRead`.

Example: 1,000 screenshots cost about $2.00, plus $0.009 per run at 2 GB.

Free: files that are not images, links that are not found, blocked by robots.txt or refused by the site, files above your size limit, damaged files that cannot be opened, and failed downloads. An image is charged when its OCR starts, so images without readable text (`no_text`) are charged, and a stopped OCR keeps what was charged (the row says so).

**Runs of mostly free images stop early.** Free images take run time that only the Actor start and the images read in the same run pay for. When that time is used up, the run stops and lists the images it did not process in `RUN-REPORT` under `notProcessedInputs`; start them in a new run.

You can cap the cost of a run with the maximum charge in the run options (at least $0.05); the run stops cleanly at that limit (also between TIFF pages) and the status message says so.

### Limits

- Tesseract reads printed text well; handwriting, stylised logos and text on busy photos give low confidence or no text (the OCR still ran, so the image is charged).
- PDFs and Office files are not images: for those use [Document to Markdown](https://apify.com/greenrun/document-to-markdown), which also runs OCR on scanned pages.
- HEIC and SVG are not supported.
- You are responsible for the images you send and for any personal data in them; the Actor keeps nothing outside your run.

### FAQ

**Do you keep the images or the text?** No. Results stay in your run's dataset in your own Apify account, under your data retention settings; images are deleted from the run's disk after OCR.

**How are languages added?** Installed languages start at once. Other codes are downloaded once per run from the official tessdata_fast 4.1.0 models (a few MB each), which adds a few seconds.

**Why was an image charged or not?** Each row has its events in `billableEvents` and free rows their reason in `error`, and the `RUN-REPORT` record in the key-value store counts them.

**Something is wrong with a result?** Open an issue on the Actor's **Issues** tab with the image link.

# Actor input Schema

## `urls` (type: `array`):

Public http or https links to images (PNG, JPEG, TIFF including multi-page, WebP, GIF, BMP), one per line. data:image/...;base64 URIs work too. Each image becomes one row; the index field keeps the input order.

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

Also read the image links found in this dataset, for example the output of a scraper. Pick the field below.

## `datasetField` (type: `string`):

Field of each dataset item that holds the image link. Dot paths and lists work: url, images, images.url, product.imageUrl.

## `languages` (type: `string`):

Tesseract language codes joined with +, for example eng, eng+deu, chi_sim, jpn, ara, rus, ukr, hin. Installed: eng, pol, deu, fra, spa, ita, por, nld. The other 115 Tesseract languages are downloaded at the start of the run (a few seconds each).

## `pageSegmentation` (type: `string`):

How Tesseract looks for text. Auto suits documents and screenshots; Sparse text finds scattered words on photos, labels and signs; Single block, line or column for crops.

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

Add every text line with its bounding box (in pixels of the original image) and confidence.

## `includeWords` (type: `boolean`):

Also add every word with its bounding box and confidence. Makes the output much larger.

## `maxImageSide` (type: `integer`):

Larger images are scaled down to this longer side before OCR (faster, cheaper, enough for normal text); images under 1000 px are scaled up 2x. At most 4000 (16 MP: two image events a page). Positions are always given in pixels of the original image.

## `maxPages` (type: `integer`):

Multi-page TIFF files: OCR at most this many pages. Each page OCR'd is at least one 'image' event, charged when its OCR starts, with or without text.

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

Larger images are skipped for free.

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

How many images are downloaded at the same time. OCR itself uses one CPU core per 4 GB of memory.

## `timeoutSecs` (type: `integer`):

Download and OCR of one image (each TIFF page) that take longer fail: free before the OCR starts; once it started, the events charged stay.

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
    "https://www.python.org/static/img/python-logo.png"
  ],
  "datasetField": "url",
  "languages": "eng",
  "pageSegmentation": "auto",
  "includeLines": true,
  "includeWords": false,
  "maxImageSide": 2500,
  "maxPages": 20,
  "maxFileSizeMb": 30,
  "maxConcurrency": 4,
  "timeoutSecs": 120
}
```

# Actor output Schema

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

No description

## `report` (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 = {
    "urls": [
        "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
        "https://www.python.org/static/img/python-logo.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("greenrun/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 = { "urls": [
        "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
        "https://www.python.org/static/img/python-logo.png",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("greenrun/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 '{
  "urls": [
    "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png",
    "https://www.python.org/static/img/python-logo.png"
  ]
}' |
apify call greenrun/image-to-text-ocr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,greenrun/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/OEOzs2BL7TDPtUMSr/builds/eDoJrrj050AYlicpo/openapi.json
