# Image to Text OCR — photos, scans & screenshots to text (`amanatools/image-to-text-ocr`) Actor

Extract text from images with Tesseract inside the Actor — no API key. Plain text plus per-line bounding boxes and confidence, auto script detection and rotation fix, Arabic/Latin/Cyrillic and more. Only images that deliver text are billed.

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

## Pricing

$1.50 / 1,000 image ocr'ds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Image to Text OCR — photos, scans & screenshots to text

Send image URLs and get the text back: plain text plus **per-line bounding
boxes and confidence scores**, detected script, automatic rotation fixing.
Tesseract runs inside the Actor — no API key, no external OCR service, no
per-provider markup, and no scraping of anyone's OCR endpoint that can break
under you.

### What you get per image

- **`text`** — plain text, one OCR line per output line, in reading order
  (Arabic and other RTL scripts come out in correct logical order).
- **`lines`** — every line with its pixel bounding box and mean confidence:
  `{text, x0, top, x1, bottom, conf}`.
- **`words`** — optional per-word detail (`include_words`), off by default.
- **`script`** (latin / arabic / mixed), **`language_used`**,
  **`mean_confidence`**, dimensions, applied rotation.

### Languages

English, Arabic (plus mixed Arabic+English), French, German, Spanish,
Portuguese, Italian, Dutch, Turkish, Russian, Persian, Urdu. `auto` detects
the script per image and picks the model; setting the language explicitly
is always more accurate when you know it.

### Pricing — you only pay for delivered text

**$0.0015 per image** that delivers at least one recognized word.

An image that fails to download, cannot be decoded, or contains **no
recognizable text is never billed.** No start fee, no per-run fee.

### Sources and limits

- Direct image file URLs: jpg, png, webp, tiff, bmp, gif.
- Up to **50 URLs** per run, **25 MB** per image.
- Very large images are automatically downscaled to ~40 MP before OCR
  (accuracy above ~300 dpi equivalent is flat; this bounds cost and time).
- Animated GIFs and multi-page TIFFs use their **first frame**.
- Phone photos stored rotated (EXIF) are handled; sideways scans are
  detected and fixed when `auto_rotate` is on.
- This actor does not crawl web pages for images — send direct file URLs
  you have the right to process.

### Tips

- **Screenshots and UI captures:** already sharp — leave defaults.
- **Receipts/documents as photos:** keep `auto_rotate` on.
- **Noisy photos:** set `min_word_confidence` to 60+ to drop guesses.
- Need scanned **PDFs** instead of images? Use
  [amanatools/pdf-ocr-extractor](https://apify.com/amanatools/pdf-ocr-extractor) —
  same engine, built for PDFs, with layout preservation.

# Actor input Schema

## `image_urls` (type: `array`):

Direct image file URLs (jpg, png, webp, tiff, bmp, gif). Up to 50 URLs per run, 25 MB per image. Animated/multi-page files use their first frame.

## `language` (type: `string`):

OCR language. 'auto' detects the script (Latin/Arabic/Cyrillic) per image and picks the model. Set it explicitly when you know it — that is always more accurate.

## `auto_rotate` (type: `boolean`):

Detect sideways/upside-down images and rotate them before OCR. Keep it on for phone photos and scans.

## `min_word_confidence` (type: `integer`):

Drop words tesseract is less confident about than this (0-100). 0 keeps everything; 60+ keeps only solid recognitions.

## `include_words` (type: `boolean`):

Add every word with its own bounding box and confidence to each item. Off by default to keep items small — lines always carry boxes and confidence.

## `include_failed_images` (type: `boolean`):

When on, images that could not be downloaded or decoded appear in the dataset as error rows (never billed). Turn off to keep the dataset clean.

## Actor input object example

```json
{
  "image_urls": [
    "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"
  ],
  "language": "auto",
  "auto_rotate": true,
  "min_word_confidence": 0,
  "include_words": false,
  "include_failed_images": true
}
```

# Actor output Schema

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

Default dataset: one item per image with text, lines, confidence and script.

# 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 = {
    "image_urls": [
        "https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("amanatools/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 = { "image_urls": ["https://raw.githubusercontent.com/tesseract-ocr/tessdoc/main/images/eurotext.png"] }

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

```

## MCP server setup

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