# Image Text Extractor (`m3web/image-text-extractor`) Actor

Extract text from images using OCR (Optical Character Recognition) via direct URLs or uploaded JSON/CSV files. Works with multiple languages and automatically enriches your structured file with the text found inside images.

- **URL**: https://apify.com/m3web/image-text-extractor.md
- **Developed by:** [M3Web](https://apify.com/m3web) (community)
- **Categories:** AI, E-commerce, Automation
- **Stats:** 76 total users, 1 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.90/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

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

Extract text from images using OCR (Optical Character Recognition) via direct URLs or uploaded JSON/CSV files. Works with multiple languages and automatically enriches your structured file with the text found inside images.

***

### ✅ Features

- Accepts **image URLs** either:
  - Directly through `startUrls`, or
  - From uploaded `.json` or `.csv` files
- Applies **OCR (Optical Character Recognition)** to each image and extracts:
  - `extractedText`: Full raw text detected
  - `paragraphs`: Text split into readable blocks
  - `urls`: Any links found within the image text
- Supports **Tesseract OCR** with multiple languages (e.g. English, German, Spanish, etc.)
- Saves results in Apify **Key-Value Store** with a shareable download link
- Logs are clean and easy to follow

***

### 📥 Input

This Actor accepts these input fields:

| Field              | Type     | Description                                                                 |
|-------------------|----------|-----------------------------------------------------------------------------|
| `Image URLs`        | `array`  | (Optional) One or more direct image URLs to process                         |
| `Upload a structured file`| `file`   | (Optional) Upload a `.json` or `.csv` file that contains image URLs          |
| `Field name for image URL`      | `string` | The name of the column or field in your file that holds the image URLs      |
| `language`         | `string` | Choose the OCR language from the dropdown (default is English)  |

#### 👇 Explaining `Field name for image URL` in simple terms

If you're uploading a `.json` or `.csv` file, you need to tell the Actor which part of each item contains the image URL. This is what the `Field name for image URL` is for:

- 🔢 In a **CSV file**, each column has a name (like `"image_url"` or `"photo"`). You should type in the exact column name where the image URL is located.
  - Example:
    ```csv
    title,image_url
    Product 1,https://example.com/image1.jpg
    Product 2,https://example.com/image2.jpg
    ```
    In this case, you'd set `Field name for image URL` to <u>**image\_url**</u>.

- 🧱 In a **JSON file**, each object has a label for its fields. You need to write the name of the field that stores the image link.
  - Example:
    ```json
    [
      { "name": "Item A", "photo": "https://example.com/photo.jpg" }
    ]
    ```
    Here, you'd set `Field name for image URL` to <u>**photo**</u>.

- 💬 You can also use dot notation to reach inside nested fields. For example, if your JSON file looks like this:
  - Example:
    ```json
    [
      { "assets": { "image": "https://example.com/image.jpg" } }
    ]
    ```
    Then set `Field name for image URL` to <u>**assets.image**</u>.

- 🔢 Multiple Images in One Row

  If your `.json` or `.csv` file contains **more than one image URL per item**, you can still process them all! Simply point to the field that holds an array of URLs.

  - Example `.json` input:

    ```json
    {
      "title": "Product Set",
      "images": [
        "https://example.com/photo1.jpg",
        "https://example.com/photo2.jpg"
      ]
    }
    ```

    Set `Field name for image URL` to <u>**images**</u> — the Actor will automatically process **all image URLs** inside that array.

    This also works with dot notation for nested arrays:

    ```json
    {
      "media": {
        "photos": [
          "https://example.com/one.jpg",
          "https://example.com/two.jpg"
        ]
      }
    }
    ```

    In this case, set `Field name for image URL` to <u>**media.photos**</u>

***

#### 🌍 OCR Language

The Actor supports many languages beyond English. At the input step, you'll see a **dropdown menu** labeled `language`. Select the appropriate language for your images (e.g. German, French, Spanish...) - the default language is English.

This helps the OCR engine correctly detect and read the text in your image.

***

### 📤 Output

After processing, you'll receive:

1. A structured **CSV or JSON file** with enriched data:
   - `extractedText`: All text found in each image
   - `paragraphs`: Text broken into readable chunks
   - `urls`: Any links found inside the image text

2. 🔗 A downloadable link to your processed file saved in Apify's Key-Value Store

3. 📊 OCR results also pushed to Apify Dataset (optional)

***

### 🚀 Example Use Cases

- Extracting text from screenshot-based Google Ads
- Enriching scraped product data with visible text
- Identifying links or CTAs from image banners

***

### 🤖 Behind the Scenes

This Actor uses:

- Tesseract.js for OCR
- Sharp for image preprocessing (grayscale, normalize)
- Support for both in-memory JSON and CSV parsing/stringifying
- Output is clean and downloadable, with clear logs and no clutter

### 💡 Tip

Want to extract thousands of image ads from Google’s Ad Transparency Center? Combine this with a crawler that scrapes `adstransparency.google.com`, then feed that structured JSON into this Actor. Boom — text from image ads, at scale.

# Actor input Schema

## `startUrls` (type: `array`):

Paste one or more direct image URLs (e.g. PNG, JPG, WebP). Each will be OCR processed.

## `uploadedDataFile` (type: `string`):

Upload a JSON or CSV file that contains image URLs in one column or object field.

## `urlKeyField` (type: `string`):

Name of the key (JSON) or column (CSV) that holds image URLs (e.g. 'image', 'img\_link').

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

Select the OCR language (Tesseract 3-letter code)

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://screentest.app/images/example-ocr.png"
    }
  ],
  "urlKeyField": "image_url",
  "language": "eng"
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://screentest.app/images/example-ocr.png"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("m3web/image-text-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 = { "startUrls": [{ "url": "https://screentest.app/images/example-ocr.png" }] }

# Run the Actor and wait for it to finish
run = client.actor("m3web/image-text-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://screentest.app/images/example-ocr.png"
    }
  ]
}' |
apify call m3web/image-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=m3web/image-text-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/T9emPKxYt5d6SxxbX/builds/jHzCfh2W9FJGqVZ9X/openapi.json
