# Image to Text OCR API with Boxes, HEIC to JPG (`fluidfaith/image-to-text-ocr`) Actor

Read text from images (JPEG, PNG, WebP, HEIC, AVIF) with line boxes and confidence, and convert iPhone HEIC photos to upright JPG. For AI agents and MCP. $0.002 per image with text; no text or errors are free.

- **URL**: https://apify.com/fluidfaith/image-to-text-ocr.md
- **Developed by:** [FFS Marketing](https://apify.com/fluidfaith) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 image read (text found)s

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/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 API with Boxes, HEIC to JPG

**Read the text in any image and hand it to your agent as JSON.** Send image links or files (photos, screenshots, scans, receipts, signs, slides) and get back the text in reading order, every line with its box and confidence, and optionally every word. iPhone HEIC photos and AVIF work as they are, and sideways camera photos are turned upright first. Need a clean image too? Ask for a JPEG, PNG or WebP copy, rotated and resized to fit Claude or GPT vision limits.

**Works as a tool for AI agents.** Add it to Claude, ChatGPT, Cursor, VS Code or any MCP client through Apify's MCP server (`https://mcp.apify.com/?tools=fluidfaith/image-to-text-ocr`), or call it with one API request. JSON in, JSON out. Setup is in [Use it from an agent](#use-it-from-an-agent).

**Costs $0.002 per image with text.** Images with no text, failed downloads, unsupported files and errors are free, and your maximum charge per run is never exceeded.

#### Why use it

- **Cheaper than sending pixels to a vision model.** Text from a screenshot or receipt costs a fraction of a vision call, and the agent gets exact characters it can search, quote and compare.
- **Boxes, not just a blob of text.** Every line comes with `x`, `y`, `w`, `h` in the original image's pixels and a confidence score, so the agent can find where a total, a heading or a button label is, or ignore low-confidence noise.
- **HEIC and AVIF just work.** iPhone photos, AVIF from the web, JPEG, PNG, WebP, GIF, BMP and TIFF. No conversion step first.
- **Upright and resized.** The camera's EXIF rotation is applied before reading, and the optional converted copy (`outputFormat`) can be shrunk to a longest side such as 1568 px for Claude vision.
- **Six languages.** English, Spanish, French, German, Portuguese and Italian, up to three at once.
- **Fast and predictable.** A typical image takes 1 to 3 seconds. Each image has a hard time limit; a stuck image comes back as an error row and is not charged.

### What you get

| Field | What it is |
|---|---|
| `index`, `source` | Position of the image in your input (rows arrive in the order images finish) and its link or file name. |
| `status` | `OK` (text found, charged), `NO_TEXT` (read, no text, free), `ERROR` (free) or `SKIPPED` (past your maximum charge, free). |
| `text` | All text in reading order; paragraphs separated by a blank line. |
| `lines` | `[{ "text", "confidence", "box": { "x", "y", "w", "h" } }]` in the original image's pixels (after upright rotation). |
| `words` | With `includeWords`: the same for every word. |
| `meanConfidence` | Average word confidence, 0 to 100. Below about 60 the image is probably blurry, tiny or handwritten. |
| `lineCount`, `wordCount` | Counts. |
| `format` | What the file really is: `jpeg`, `png`, `webp`, `heic`, `avif`, `gif`, `bmp`, `tiff`. |
| `width`, `height` | Size of the upright image in pixels. |
| `orientationFixed` | `true` when the photo was stored sideways or upside down and was turned upright. |
| `imageUrl`, `image` | With `outputFormat`: link to the converted JPEG, PNG or WebP, and its format, size and bytes. |
| `charged` | What this image cost. |
| `error` | Why an image failed, in plain words (always free). |

A run summary (`OUTPUT` in the key-value store) has the counts, the total charged and `stoppedAtSpendingCap`.

### Input

```json
{
  "urls": ["https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.png"],
  "languages": ["eng"],
  "layout": "auto",
  "includeWords": false,
  "outputFormat": "none"
}
```

| Field | Default | What it does |
|---|---|---|
| `urls` | | Public image links, up to 500 per run, 25 MB and 60 megapixels each (24 megapixels below 1 GB of memory). |
| `files` | | Images sent inline: `[{"name": "IMG_0001.HEIC", "base64": "..."}]`, up to 10 files of 10 MB. |
| `ocr` | `true` | Turn off to only convert images (then `outputFormat` is required). |
| `languages` | `["eng"]` | Up to 3 of `eng`, `spa`, `fra`, `deu`, `por`, `ita`. |
| `layout` | `auto` | `auto` for documents, screenshots and most photos; `block` for one block (receipts, labels); `sparse` for scattered text (signs, posters, app screens); `line` for a single line. |
| `includeWords` | `false` | Also return every word with its box. |
| `minConfidence` | `0` | Drop words below this confidence (0 to 100). |
| `outputFormat` | `none` | `jpeg`, `png` or `webp`: also save an upright converted copy and return its link. |
| `outputMaxSide` | `0` | Shrink the copy so its longest side is at most this many pixels. 0 keeps the size. |
| `quality` | `85` | JPEG or WebP quality. |
| `maxConcurrency` | `4` | Images in parallel (lowered to fit memory). |

### Output

```json
{
  "index": 0,
  "source": "https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.png",
  "status": "OK",
  "format": "png",
  "width": 900,
  "height": 420,
  "orientationFixed": false,
  "text": "INVOICE 4821\nTotal due: $1,347.50\nPay by December 15, 2026",
  "lineCount": 3,
  "wordCount": 10,
  "meanConfidence": 96.2,
  "lines": [
    { "text": "INVOICE 4821", "confidence": 96.2, "box": { "x": 55, "y": 58, "w": 304, "h": 37 } }
  ],
  "imageUrl": null,
  "charged": { "event": "image-read", "count": 1, "usd": 0.002 },
  "error": null
}
```

### Use it from an agent

#### Through Apify's MCP server (Claude, ChatGPT, Cursor, VS Code, any MCP client)

```json
{
  "mcpServers": {
    "image-ocr": {
      "url": "https://mcp.apify.com/?tools=fluidfaith/image-to-text-ocr",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

**Claude Code:** `claude mcp add --transport http image-ocr "https://mcp.apify.com/?tools=fluidfaith/image-to-text-ocr" --header "Authorization: Bearer $APIFY_TOKEN"`. Or over stdio: `npx -y @apify/actors-mcp-server --tools fluidfaith/image-to-text-ocr` with `APIFY_TOKEN` set.

A good instruction for agents: *"When you need the words in an image (a screenshot, receipt, sign or scan), call image-to-text-ocr with its link and use `text`; use `lines[].box` to say where something is. If meanConfidence is under 60, say the image is hard to read."*

#### Through the API (one call, waits for the result)

```bash
curl -s -X POST "https://api.apify.com/v2/acts/fluidfaith~image-to-text-ocr/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"urls":["https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.heic"],"outputFormat":"jpeg"}'
```

#### From Python

```python
from apify_client import ApifyClient
import os
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("fluidfaith/image-to-text-ocr").call(run_input={"urls": ["https://example.com/receipt.jpg"], "layout": "block"})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["status"], item["text"] or item["error"])
```

### Pricing

Pay per event: **$0.002 per image where text was found.** No start fee. Free: images with no text, failed or blocked downloads, unsupported or broken files, and images that hit the time limit. With OCR turned off (convert only), **$0.001 per converted image.** 1,000 images with text cost $2. Set a maximum charge per run and the Actor stops before it, never after; the summary then shows `stoppedAtSpendingCap: true`, and images past the limit come back as `SKIPPED`, free.

### Safety

- Only public addresses are fetched: localhost, private networks, link-local and cloud metadata addresses (such as 169.254.169.254) are refused, including through redirects and DNS answers that point at them.
- Each image is decoded and read in its own process with a hard time limit, and images over 60 megapixels are refused, so a hostile file cannot hang or exhaust the run.
- No logins, no cookies, no captcha solving.

### Privacy

Images and text stay in your own Apify run storage; nothing is sent to any other service (OCR runs inside the Actor, no third-party API). Logs hold only the link, status and counts, never the text.

### FAQ

**Is it good on handwriting?** Printed text is the strength. Neat handwriting sometimes works; check `meanConfidence`.

**What about PDFs?** Use [PDF to Markdown with Tables](https://apify.com/fluidfaith/pdf-to-markdown-tables), which reads every page (with OCR for scans) and returns tables as JSON.

**Why was my image NO_TEXT?** No readable text was found (a photo with no words, or text too small or blurry). It is free. Try `layout: "sparse"` for scattered text.

**Can I just convert HEIC to JPG?** Yes: `"ocr": false, "outputFormat": "jpeg"`. $0.001 per image.

**How long are converted images kept?** In your run's key-value store, for as long as your Apify plan keeps run storage.

### Other Actors by Fluid Faith

- [PDF to Markdown with Tables](https://apify.com/fluidfaith/pdf-to-markdown-tables): PDF, Word, PowerPoint and Excel to Markdown with every table as JSON rows. $0.002 per page.
- [Mermaid, Graphviz & Chart to PNG, SVG or PDF](https://apify.com/fluidfaith/mermaid-chart-renderer): diagram or chart code to an image link, with error lines when the code is wrong. $0.003 per diagram.
- [Video Frame Extractor & Media Probe](https://apify.com/fluidfaith/media-probe): ffprobe metadata, frames, scene cuts, a contact sheet and loudness from direct video or audio links. $0.001 per frame.
- [Visual Regression & Screenshot Diff for AI Agents](https://apify.com/fluidfaith/visual-diff-gate): production vs preview, percent changed, changed regions and PASS or FAIL per viewport. $0.005 per page pair per viewport.
- [Mobile Website Test on iPhone & Android (Mobile QA Gate)](https://apify.com/fluidfaith/mobile-qa-gate): PASS or FAIL per page on today's phones, with screenshots. $0.01 per page per phone.
- [Lighthouse & Accessibility Audit](https://apify.com/fluidfaith/lighthouse-gate): Lighthouse scores, Core Web Vitals and axe-core issues with the top 5 fixes. $0.02 per URL per form factor.

Load them together as MCP tools: `https://mcp.apify.com/?tools=fluidfaith/image-to-text-ocr,fluidfaith/pdf-to-markdown-tables,fluidfaith/mermaid-chart-renderer,fluidfaith/visual-diff-gate,fluidfaith/mobile-qa-gate,fluidfaith/lighthouse-gate,fluidfaith/media-probe`

# Actor input Schema

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

Public links to images to read: photos, screenshots, scans, receipts, signs, slides. JPEG, PNG, WebP, HEIC (iPhone), AVIF, GIF, BMP and TIFF, up to 25 MB and 60 megapixels each. Up to 500 links per run.

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

Images sent inline instead of a link: a list of {"name": "photo.heic", "base64": "..."}. Up to 10 files of 10 MB each.

## `ocr` (type: `boolean`):

Read the text in each image. Turn off to only convert images (for example HEIC to JPEG); then outputFormat must be set.

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

Languages in the images, up to 3. eng English, spa Spanish, fra French, deu German, por Portuguese, ita Italian.

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

auto: documents, screenshots and most photos. block: one uniform block of text (a receipt, a label). sparse: scattered text (signs, posters, UI). line: a single line.

## `includeWords` (type: `boolean`):

Also return every word with its box and confidence (lines with boxes are always returned).

## `minConfidence` (type: `integer`):

Drop words read with less confidence than this (0 to 100). 0 keeps everything.

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

Also save a normalized copy of each image: rotated upright from the camera's EXIF tag, HEIC or AVIF turned into JPEG, PNG or WebP. The copy's link is in imageUrl. none: no copy.

## `outputMaxSide` (type: `integer`):

Shrink the converted copy so its longest side is at most this many pixels (1568 fits Claude vision, 2048 fits GPT vision). 0 keeps the size.

## `quality` (type: `integer`):

JPEG or WebP quality, 40 to 100.

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

How many images to process at once (lowered automatically to fit the run's memory).

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.png"
  ],
  "ocr": true,
  "languages": [
    "eng"
  ],
  "layout": "auto",
  "includeWords": false,
  "minConfidence": 0,
  "outputFormat": "none",
  "outputMaxSide": 0,
  "quality": 85,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "urls": [
        "https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fluidfaith/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 = { "urls": ["https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.png"] }

# Run the Actor and wait for it to finish
run = client.actor("fluidfaith/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 '{
  "urls": [
    "https://raw.githubusercontent.com/faithdrivencreator/apify-agent-tools/main/image-to-text-ocr/samples/invoice.png"
  ]
}' |
apify call fluidfaith/image-to-text-ocr --silent --output-dataset

```

## MCP server setup

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