# Image OCR Extractor (`gochujang/image-ocr-extractor`) Actor

Extract text from images (PNG, JPG, WebP, TIFF) using Tesseract OCR. Batch up to 50 images, multi-language, confidence scores.

- **URL**: https://apify.com/gochujang/image-ocr-extractor.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 OCR Extractor

> Extract text from images (PNG, JPG, WebP, TIFF, BMP) using **Tesseract OCR**. Batch up to 50 images, multi-language (100+ languages), confidence scores. **$0.002/image.**

***

### Why this exists

Images containing text — screenshots, scanned forms, product labels, street signs, whiteboards — can't be searched or processed until the text is extracted. This actor handles the OCR pipeline: download the image, preprocess it, run Tesseract, and return structured output with confidence scores.

***

### What you get

```json
{
  "index": 1,
  "url": "https://example.com/screenshot.png",
  "ok": true,
  "text": "Invoice #2024-001\nBill To: Acme Corp\nTotal: $1,250.00",
  "word_count": 9,
  "confidence": 87.4,
  "language": "eng",
  "error": null
}
```

***

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `urls` | array | — | List of image URLs (batch mode, up to 50) |
| `url` | string | — | Single image URL (used when `urls` is empty) |
| `language` | string | `eng` | Tesseract language code (`eng`, `deu`, `fra`, `spa`, `jpn`, `chi_sim`, `kor`, or combined `eng+deu`) |
| `preprocessing` | string | `grayscale` | Image preprocessing: `none`, `grayscale`, or `threshold` (binarize) |
| `pageSegMode` | integer | `3` | Tesseract PSM: 3=auto, 6=block, 7=line, 8=word, 11=sparse |
| `limit` | integer | `50` | Max images to process (cap: 200) |

***

### Quick start

#### Single image

```json
{
  "url": "https://example.com/invoice.png"
}
```

#### Batch of screenshots

```json
{
  "urls": [
    "https://example.com/slide1.png",
    "https://example.com/slide2.png"
  ],
  "language": "eng",
  "preprocessing": "grayscale"
}
```

#### Japanese document

```json
{
  "url": "https://example.com/japanese-receipt.jpg",
  "language": "jpn",
  "preprocessing": "threshold",
  "pageSegMode": 6
}
```

***

### Preprocessing Tips

| Mode | Best for |
|---|---|
| `grayscale` | Photos, colored backgrounds, most general use |
| `threshold` | Documents with dark text on white background, typed forms |
| `none` | When the image is already clean B\&W |

***

### Supported Languages (pre-installed)

`eng` (English), `deu` (German), `fra` (French), `spa` (Spanish), `jpn` (Japanese), `chi_sim` (Simplified Chinese), `kor` (Korean)

Multi-language: `"eng+fra"` — useful for bilingual documents.

***

### Pricing

**Pay-Per-Event**: `$0.002` per image successfully OCR-processed.

| Images | Cost |
|---|---|
| 10 screenshots | $0.02 |
| 50 images (full batch) | $0.10 |
| 200 product photos | $0.40 |

***

### Use cases

1. **Invoice / receipt digitization** — Extract line items, totals, vendor names
2. **Screenshot text extraction** — Turn UI screenshots into searchable text
3. **Multilingual document processing** — Japanese, Chinese, Korean, European languages
4. **Form digitization** — Handwritten or typed form fields
5. **Whiteboard photos** — Meeting notes, diagrams with text

***

### Confidence score

Each result includes an `confidence` score (0–100) from Tesseract:

- **85–100**: High quality OCR, likely accurate
- **60–84**: Moderate, review critical fields
- **< 60**: Low confidence — consider using `threshold` preprocessing or higher-resolution source image

***

### Related actors (same author)

- [PDF Text & Table Extractor](https://apify.com/gochujang/pdf-text-extractor) — PDF version with table detection
- [Web Page → Markdown Converter](https://apify.com/gochujang/web-to-markdown) — HTML text extraction

***

### Feedback

[Leave a review on Apify Store](https://apify.com/gochujang/image-ocr-extractor#reviews)

# Actor input Schema

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

List of image URLs to OCR (PNG, JPG, WebP, TIFF, BMP). Up to 50 per run.

## `url` (type: `string`):

Used when 'urls' is empty.

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

Tesseract language code. 'eng' (English), 'deu' (German), 'fra' (French), 'spa' (Spanish), 'jpn' (Japanese), 'chi\_sim' (Simplified Chinese), 'kor' (Korean). Multi-language: 'eng+deu'.

## `preprocessing` (type: `string`):

Apply image preprocessing before OCR. 'none' = raw image. 'grayscale' = convert to grayscale (often improves accuracy). 'threshold' = binary black/white (best for documents with clear text on white background).

## `pageSegMode` (type: `integer`):

Tesseract PSM. 3 = auto (default), 6 = single block of text, 7 = single line, 8 = single word, 11 = sparse text (scattered text). See Tesseract docs.

## `limit` (type: `integer`):

Max number of images to process (cap: 200).

## Actor input object example

```json
{
  "urls": [
    "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg"
  ],
  "url": "",
  "language": "eng",
  "preprocessing": "grayscale",
  "pageSegMode": 3,
  "limit": 50
}
```

# 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://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/image-ocr-extractor").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://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("gochujang/image-ocr-extractor").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://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg"
  ]
}' |
apify call gochujang/image-ocr-extractor --silent --output-dataset

```

## MCP server setup

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

```

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/lLnKDJXM395nSyWXi/builds/HEQqq275sLcdfRMUI/openapi.json
