# Image to Text OCR: Extract Text from Images in Bulk (`malmurk/image-to-text-ocr`) Actor

Extract text from images by URL, upload or key-value store: JPG, PNG, WEBP, TIFF, BMP, GIF. OCR in 30 languages with confidence scores and optional line and word bounding boxes. Runs Tesseract locally, no external OCR API. $1.50 per 1,000 images with text; blank images and failed URLs are free.

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

## Pricing

from $1.50 / 1,000 image with texts

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: Extract Text from Images in Bulk

**Image to Text OCR** extracts text from images in bulk. Paste image URLs, upload files or point it at a key-value store, and get one row per image with the **recognised text**, a **confidence score**, the **detected language** and, if you want them, **every line and word with its bounding box**. It works as an **OCR API** for screenshots, scanned documents, receipts, letters, labels, signs and logos.

**$1.50 per 1,000 images with text. Images where no text is found, broken links and non-image files are free.**

- **Bulk image OCR.** Hundreds of image URLs in one run, several read in parallel. A bad link doesn't stop the run: it gets its own row with the reason.
- **JPG, PNG, WEBP, TIFF, BMP, GIF** (and AVIF). For animated GIFs and multi-page TIFFs, only the first frame is read.
- **30 OCR languages**: English, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Czech, Romanian, Russian, Ukrainian, Turkish, Swedish, Danish, Norwegian, Finnish, Hungarian, Bulgarian, Greek, Vietnamese, Indonesian, Arabic, Hebrew, Hindi, Chinese (Simplified and Traditional), Japanese, Korean and Thai.
- **Confidence scores and word boxes.** Every line and word comes with its pixel position and a 0–100 confidence, at the same price as plain text.
- **Private by design.** OCR runs inside your Apify run with the open-source Tesseract engine. Your images are not sent to Google, OpenAI or any other OCR service.
- **Handles awkward images.** Phone photos are turned upright using their EXIF orientation. White text on a transparent background (a typical logo) is still read. 16-bit scans are handled.

### What does Image to Text OCR do?

You give it images and it returns one dataset row per image:

| Field | What you get |
|---|---|
| `text` | The recognised text in reading order. Lines are separated by a newline, paragraphs by a blank line. |
| `confidence` | Average word confidence, 0–100. Low values flag blurry or hard-to-read images. |
| `language` | Detected language of the text (`en`, `de`, `ru`...), when there are about 40 letters or more. |
| `char_count`, `word_count`, `line_count` | Size of the result. |
| `lines` | With **Output: lines** or **words**: each line's text, confidence and box (`left`, `top`, `width`, `height`). |
| `words` | With **Output: words**: each word's text, confidence and box. |
| `image_format`, `width`, `height`, `frames` | What the file was. |
| `url`, `file_name`, `index` | Where the image came from and its position in your input. |
| `error` | Why an image failed. Failed images are never charged. |

### Example output

A real run on 7 URLs (languages English + German + French, 4 in parallel):

| Image | Format | Characters | Confidence | Language | Charged |
|---|---|---|---|---|---|
| phototest.tif (typed page) | TIFF | 285 | 96.2 | en | $0.0015 |
| eurotext.png (mixed-language sample) | PNG | 412 | 93.5 | | $0.0015 |
| 1965 typewritten letter (Wikimedia Commons) | JPEG | 485 | 82.0 | en | $0.0015 |
| Kansas Commerce logo (white on transparent) | WEBP | 16 | 96.1 | | $0.0015 |
| Wildey logo | GIF | 6 | 92.1 | | $0.0015 |
| no-such-image.png | | | | | free: `download failed: HTTP 404` |
| example.com (a web page) | | | | | free: `the URL returned an HTML web page, not an image` |

One row, shortened:

```json
{
  "index": 1,
  "url": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
  "file_name": "phototest.tif",
  "text": "This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.\n\nThe quick brown dog jumped over the\nlazy fox. ...",
  "char_count": 285, "word_count": 60, "line_count": 8,
  "confidence": 96.2, "language": "en", "ocr_languages": "eng+deu+fra",
  "image_format": "TIFF", "width": 640, "height": 480, "frames": 1,
  "lines": [{"text": "This is a lot of 12 point text to test the", "confidence": 96.5,
             "left": 36, "top": 92, "width": 544, "height": 30, "block": 1, "paragraph": 1, "line": 1}],
  "words": null,
  "error": null
}
```

### Who it's for

- **Developers and AI agents** that need an image-to-text step in a pipeline: screenshots to text, scanned forms to text, product photos to searchable labels.
- **Data teams** turning folders of scanned letters, receipts, invoices or archive images into searchable text.
- **E-commerce and marketing teams** reading the text in product images, banners and social media graphics.
- **Anyone who wants OCR without sending images** to a third-party AI or Google service.

### How to extract text from images

1. Click **Try for free** and create a free Apify account.
2. Paste image links into **Image URLs**, or upload images.
3. Pick the **Text languages** printed in your images. Leave English if unsure.
4. Optional: set **Output** to *lines* or *words* if you need positions, and **Layout** to *Sparse text* for photos of signs or labels.
5. Click **Start**. Download the results as JSON, CSV or Excel, or read them through the API.

### Input

| Field | Default | Description |
|---|---|---|
| `startUrls` | 3 sample images | Direct links to image files. |
| `files` | | Images you upload in the input form. |
| `keyValueStoreId` | | One of your key-value stores. Every binary record is OCR'd; JSON and text records are skipped. |
| `keyValueStoreKeys` | all | Only these keys from that store. |
| `languages` | `["eng"]` | Tesseract language codes. Each extra language makes OCR slower. |
| `outputFormat` | `text` | `text`, `lines` (adds line boxes) or `words` (adds line and word boxes). |
| `pageSegmentationMode` | `auto` | `auto`, `single_column`, `single_block`, `sparse` (scattered text in photos) or `single_line`. |
| `detectLanguage` | `true` | Add the detected language to each row. |
| `maxConcurrency` | `4` | Images processed at the same time (1–32). |

API example:

```json
{
  "startUrls": [{"url": "https://example.com/receipt.jpg"}, {"url": "https://example.com/screenshot.png"}],
  "languages": ["eng", "deu"],
  "outputFormat": "words"
}
```

### Pricing

Pay per event:

| Event | Price |
|---|---|
| Image with text (OCR found at least one word) | $0.0015 ($1.50 per 1,000) |
| Image without text, failed download, not an image | free |

Set **Maximum cost per run** in the run options: the Actor stops starting new images before it would go over it.

### Tips for better OCR results

- **Pick the right language.** Tesseract reads only the scripts you select: Cyrillic needs `rus`/`ukr`/`bul`, Chinese needs `chi_sim` or `chi_tra`.
- **Resolution matters.** Text smaller than about 10 pixels tall reads poorly. Use the original image, not a thumbnail.
- **Photos of scenes** (street signs, product shelves) work better with **Layout: Sparse text**.
- **Use the confidence score** to flag rows for review: below about 60 usually means a blurry or stylised image.
- **Handwriting** isn't what Tesseract is built for: expect poor results on handwritten notes.

### Limits

- One frame per image: the first frame of animated GIF/WEBP files and multi-page TIFFs.
- Files up to 50 MB and 150 megapixels; images over 40 megapixels are scaled down before OCR (boxes are still reported in the original image's pixels).
- Links must point at the image file itself. A web page that shows the image returns an error row. Links to a text file of URLs (`requestsFromUrl`) are not supported.
- PDFs are not read here: use [PDF Text Extractor](https://apify.com/malmurk/pdf-text-extractor), which OCRs scanned pages and reads text layers directly.

### FAQ

**Is there an OCR API?** Yes. Run the Actor through the [Apify API](https://docs.apify.com/api/v2) or any Apify client and read the dataset. Each run returns one row per image.

**Which OCR engine does it use?** [Tesseract 5](https://github.com/tesseract-ocr/tesseract) with the fast LSTM models, inside the Actor's own container. No external OCR or AI service is called.

**Do I pay for images without text?** No. If OCR finds no words, the row is still saved (with empty text) and isn't charged. Failed downloads and non-image files aren't charged either.

**Can I OCR images another Actor saved?** Yes. Set **Key-value store with images** to that store's ID.

**Is it legal?** The Actor only reads images you link to or upload. Make sure you have the right to process them.

# Actor input Schema

## `startUrls` (type: `array`):

Direct links to image files: JPG, PNG, WEBP, TIFF, BMP or GIF (animated GIFs and multi-page TIFFs: first frame only). A link to a web page that shows the image won't work: use the image's own URL.

## `files` (type: `array`):

Upload images from your computer. They are stored in your Apify account and processed like the URLs above.

## `keyValueStoreId` (type: `string`):

Process images saved in one of your key-value stores (for example by another Actor). Records that are JSON or text are skipped.

## `keyValueStoreKeys` (type: `array`):

Only process these keys from the key-value store above. Leave empty to process every image in the store.

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

Languages printed in your images. Pick only the ones you need: each extra language makes OCR slower and can lower accuracy.

## `outputFormat` (type: `string`):

Plain text only, or also every line (and optionally every word) with its bounding box in pixels and its confidence. Same price for all three.

## `pageSegmentationMode` (type: `string`):

How the image is split into text blocks. Auto suits documents and screenshots. Use 'Sparse text' for photos, signs, memes and labels with scattered text, and 'Single line' for an image that holds one line of text, such as a serial number or product code.

## `detectLanguage` (type: `boolean`):

Add the detected language of the recognised text (ISO 639-1 code such as 'en', 'de', 'ru') to every row. Needs about 40 letters of text.

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

How many images are downloaded and read at the same time. More memory for the run means more CPU, so raise both together for large batches.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
    },
    {
      "url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
    },
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/e/e2/Typewritten_letter_from_Dr_Claude_H_Organ_Jr_MD_FACS_to_Dr_Leonidas_Berry_dated_October_5_1965.jpg"
    }
  ],
  "languages": [
    "eng"
  ],
  "outputFormat": "text",
  "pageSegmentationMode": "auto",
  "detectLanguage": true,
  "maxConcurrency": 4
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
        },
        {
            "url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
        },
        {
            "url": "https://upload.wikimedia.org/wikipedia/commons/e/e2/Typewritten_letter_from_Dr_Claude_H_Organ_Jr_MD_FACS_to_Dr_Leonidas_Berry_dated_October_5_1965.jpg"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("malmurk/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 = { "startUrls": [
        { "url": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif" },
        { "url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png" },
        { "url": "https://upload.wikimedia.org/wikipedia/commons/e/e2/Typewritten_letter_from_Dr_Claude_H_Organ_Jr_MD_FACS_to_Dr_Leonidas_Berry_dated_October_5_1965.jpg" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("malmurk/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 '{
  "startUrls": [
    {
      "url": "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
    },
    {
      "url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
    },
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/e/e2/Typewritten_letter_from_Dr_Claude_H_Organ_Jr_MD_FACS_to_Dr_Leonidas_Berry_dated_October_5_1965.jpg"
    }
  ]
}' |
apify call malmurk/image-to-text-ocr --silent --output-dataset

```

## MCP server setup

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