# Image OCR to Text, Private & Local (Tesseract, PT-BR + EN) (`kman-br/image-ocr-tesseract`) Actor

Extract text from many images (PNG, JPG, WebP, TIFF, BMP, GIF) with Tesseract running inside the Actor. No third-party OCR API: images never leave the run. Portuguese and English, confidence per image and per line, CPF/e-mail/phone masking.

- **URL**: https://apify.com/kman-br/image-ocr-tesseract.md
- **Developed by:** [Kman](https://apify.com/kman-br) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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 OCR to Text: private, local Tesseract (PT-BR + EN)

**EN** · [PT-BR abaixo](#pt-br)

Turn up to 200 images per run into clean text. OCR runs **inside the Actor with Tesseract** (Apache 2.0). No Google, AWS or OpenAI OCR call: your images and text never leave the run.

### Why this Actor

- **Private**: no third-party OCR API, no proxy. Images are downloaded from your URLs, read in memory and discarded.
- **Portuguese + English** models (Tesseract `best_int`), selectable.
- **Confidence** per image (and per line with `incluirLinhas`), plus a `baixa_confianca` flag you control.
- **Personal-data masking**: CPF, e-mail addresses and phone numbers in the recognised text are replaced by `[cpf]`, `[email]`, `[telefone]`.
- **Safe fetching**: private, loopback and cloud-metadata addresses are refused; 15 MB per image; 30 s per download.
- Pairs with our **PDF to Text & Markdown** Actor (`kman-br/pdf-to-text-markdown`) for scanned PDFs.

### Input

```json
{ "imageUrls": ["https://tesseract.projectnaptha.com/img/eng_bw.png"], "idiomas": ["por", "eng"], "confiancaMinima": 60, "incluirLinhas": false }
```

### Output

```json
{ "url": "https://tesseract.projectnaptha.com/img/eng_bw.png", "status": "ok", "formato": "png", "texto": "Mild Splendour of the various-vested Night! …", "palavras": 58, "confianca": 93, "baixa_confianca": false, "dados_pessoais_mascarados": 0, "ms_ocr": 530 }
```

### Pricing (pay per event)

- US$ 0.01 per run
- US$ 0.0025 per image read (1,000 images = US$ 2.50)
  Failed downloads, non-image files and blocked addresses are free.

### Notes

Handwriting and very low-resolution photos give poor results; check `confianca`. Images above 40 megapixels are refused. Each run has a compute budget tied to the per-image price: a very dense image whose OCR would cost more than its price is skipped free (`ocr_lento_demais_para_o_preco`), and when the budget runs out the run ends with `status: parcial`, `motivo: orcamento_computacao` and the remaining URLs listed as not processed. Memory is fixed at 1024 MB. You are responsible for having the right to process the images you submit.

***

### PT-BR

OCR em lote de imagens (PNG, JPG, WebP, TIFF, BMP, GIF) com **Tesseract rodando dentro do Actor**. Nada vai para API de terceiros.

- Português e inglês, confiança por imagem e por linha.
- Mascara CPF, e-mail e telefone no texto reconhecido (LGPD).
- Recusa endereços privados/locais (inclusive em redirecionamentos), limite de 15 MB e 40 megapixels por imagem.
- Orçamento de computação por execução ligado ao preço: imagem densa demais é pulada sem cobrança e, se o orçamento acabar, a execução termina como parcial.
- Preço: US$ 0,01 por execução + US$ 0,0025 por imagem lida. Erros não são cobrados.
- Para PDF escaneado, use junto com o `kman-br/pdf-to-text-markdown`.

# Actor input Schema

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

Uma URL http(s) pública por linha, até 200 por execução, até 15 MB cada.

## `idiomas` (type: `array`):

Modelos Tesseract carregados.

## `confiancaMinima` (type: `integer`):

Marca baixa_confianca quando a média ficar abaixo (o item continua sendo entregue).

## `incluirLinhas` (type: `boolean`):

Adiciona a lista de linhas com a confiança de cada uma.

## Actor input object example

```json
{
  "imageUrls": [
    "https://tesseract.projectnaptha.com/img/eng_bw.png"
  ],
  "idiomas": [
    "por",
    "eng"
  ],
  "confiancaMinima": 0,
  "incluirLinhas": false
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

RUN_SUMMARY: status, counts, charged events.

# 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://tesseract.projectnaptha.com/img/eng_bw.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kman-br/image-ocr-tesseract").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://tesseract.projectnaptha.com/img/eng_bw.png"] }

# Run the Actor and wait for it to finish
run = client.actor("kman-br/image-ocr-tesseract").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://tesseract.projectnaptha.com/img/eng_bw.png"
  ]
}' |
apify call kman-br/image-ocr-tesseract --silent --output-dataset

```

## MCP server setup

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

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/ScifdaVYfW8RjW1xp/builds/GfTf9XeKZSZfdoNiZ/openapi.json
