# Image to Text OCR (Screenshots, Scans, Photos) (`dofunbiz/image-ocr`) Actor

Extract text from images by URL: screenshots, scanned documents, receipts, photos of pages. Paragraph-aware text, confidence scores, optional word boxes. 7 languages.

- **URL**: https://apify.com/dofunbiz/image-ocr.md
- **Developed by:** [Scot C](https://apify.com/dofunbiz) (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.00 / 1,000 image reads

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 (Screenshots, Scans, Photos)

Extract text from images in bulk: **screenshots, scanned documents, receipts, photos of pages, slides and UI captures**. Paste image links and get clean, paragraph-aware text back, plus confidence scores so you know which results to trust.

### Features

- **Paragraph-aware text**: lines are grouped into paragraphs, and words hyphenated across line breaks are re-joined.
- **Confidence scores**: average confidence per image plus a count of low-confidence words, so automations can flag poor scans.
- **Automatic enhancement**: EXIF auto-rotation (phone photos), grayscale, auto-contrast, and upscaling of small screenshots for better accuracy.
- **Layout modes**: Auto (documents and screenshots), Single block (a cropped paragraph) or Sparse (signs, labels, UI text).
- **Word positions (optional)**: every word with its bounding box and confidence, in original-image pixels.
- **7 languages**: English, German, French, Spanish, Italian, Portuguese and Dutch, plus mixed English/German, English/French and English/Spanish.
- **Formats**: PNG, JPG, WEBP, TIFF, BMP and GIF (first frame), up to 25 MB.
- **Private by design**: it runs open-source Tesseract inside the Actor. Your images aren't sent to any third-party OCR API.

### Who it's for

- **Automation builders** (Make, Zapier, n8n): turn screenshots or uploaded images into text in one API call.
- **AI pipelines**: feed text from images into LLMs and RAG.
- **Back-office work**: read receipts, labels and scanned letters in bulk.

### Input

| Field | Example |
|---|---|
| Image URLs | `https://example.com/receipt.jpg` |
| Language | English |
| Layout | Auto |
| Enhance image | on |
| Include word positions | off |

### Output (one row per image)

```json
{
  "url": "https://.../phototest.tif",
  "text": "This is a lot of 12 point text to test the ocr code and see if it works on all types of file format.\n\nThe quick brown dog jumped over the lazy fox. ...",
  "wordCount": 60,
  "meanConfidence": 95.1,
  "lowConfidenceWords": 0,
  "width": 640, "height": 480, "imageFormat": "TIFF"
}
```

### Pricing

**Pay per image successfully read.** Failed downloads and unreadable files are never charged. The Actor also respects Apify's maximum-charge-per-run setting.

### Good to know

- Works best on printed text. Handwriting and very blurry or low-resolution photos give weaker results; check `meanConfidence`.
- For PDF files, use [PDF to Markdown for AI & RAG](https://apify.com/dofunbiz/pdf-to-markdown). It handles text-layer PDFs and runs OCR on scanned pages automatically.
- Only process images you have the right to use.

# Actor input Schema

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

Direct links to images (PNG, JPG, WEBP, TIFF, BMP, GIF). Up to 25 MB each. For PDFs use our PDF to Markdown Actor.

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

Text language(s) in the images.

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

'Auto' suits documents and screenshots. 'Single block' suits one paragraph or a cropped region. 'Sparse' suits scattered text (signs, labels, UI).

## `preprocess` (type: `boolean`):

Grayscale, auto-contrast, EXIF rotation and upscaling of small images. Usually improves accuracy.

## `includeWordBoxes` (type: `boolean`):

Add every word with its confidence and bounding box (x, y, width, height in original image pixels).

## Actor input object example

```json
{
  "imageUrls": [
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ],
  "language": "eng",
  "layout": "auto",
  "preprocess": true,
  "includeWordBoxes": false
}
```

# Actor output Schema

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

Extracted text per image.

# 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://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dofunbiz/image-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://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"] }

# Run the Actor and wait for it to finish
run = client.actor("dofunbiz/image-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://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ]
}' |
apify call dofunbiz/image-ocr --silent --output-dataset

```

## MCP server setup

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