# Google Lens OCR — Image to Text API (`s-r/google-lens-ocr`) Actor

- **URL**: https://apify.com/s-r/google-lens-ocr.md
- **Developed by:** [SR](https://apify.com/s-r) (community)
- **Categories:** AI, Developer tools
- **Stats:** 3 total users, 2 monthly users, 80.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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Google Lens OCR: Image to Text API

Extract text from an image with the same engine that powers Google Lens. This image to text API sends your images to the Google Lens crupload endpoint, reads the text back, and returns it as clean full text plus word-level bounding boxes. No browser, no OCR model to host, no GPU. Around two seconds per image.

Point it at a list of direct image URLs and get back the recognized text, paragraph structure, the detected language, and (optionally) a translation of the whole thing. It handles photos of signs, receipts, screenshots, scanned pages, handwriting, and product labels, the messy real-world images that trip up classic OCR libraries.

If you have ever wanted an **image to text API** that just works without wiring up a cloud vision account, this is it.

### What you get

- **Full recognized text** for every image, one paragraph per line, ready to index or search.
- **Paragraph blocks** with their child lines and normalized geometry, so you can rebuild the layout of a document.
- **Word-level bounding boxes** with pixel-normalized coordinates: `center_x`, `center_y`, `width`, `height`, and `angle_deg` for rotated text. Coordinates run 0 to 1 so they work at any image size.
- **Detected language** so you know what the engine actually read.
- **Optional translation** of the recognized text to any two-letter language code, in the same run, no second API call.
- **Word count, image dimensions, and timing** on every row for quick QA and cost tracking.

### Why use Google Lens OCR

Classic OCR engines like Tesseract were built for clean, high-contrast scans. Point them at a phone photo of a crumpled receipt, a street sign at an angle, or a handwritten note, and accuracy falls off a cliff. Google Lens was trained on exactly those images. It copes with skew, glare, low light, mixed fonts, and background clutter because that is the input it was designed for.

Lens also reads scripts that give lighter-weight engines trouble, including CJK (Chinese, Japanese, Korean), Arabic, Cyrillic, and Devanagari, and it handles mixed-language images without you telling it which language to expect. The `ocr_language` hint is a nudge, not a hard switch, so you rarely have to get it exactly right.

The practical payoff is that you get Google-grade recognition without a Google Cloud account. There is no service enablement, no API key rotation, no billing project to set up, and no client library to pin. You pass image URLs in, you get structured text out, and you pay per image on Apify. For a lot of teams that removes a week of plumbing.

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `image_urls` | array of strings | Yes | Direct URLs of images to OCR (JPG, PNG, WEBP, TIFF, GIF). One per line, up to 200 per run. |
| `ocr_language` | string | No | Two-letter language hint for recognition (`en`, `nl`, `de`, `fr`, `ja`, `zh`). Lens auto-detects; this only nudges it. Defaults to `en`. |
| `translate_to` | string | No | Translate the recognized text to this two-letter code (for example `en`, `nl`). Leave empty for OCR only. |
| `include_word_boxes` | boolean | No | Emit every word with its normalized geometry (center, size, rotation). Turn off for smaller output. Defaults to `true`. |

### Output

One dataset row per image. Here is a trimmed example showing the full text plus a single word with its geometry.

```json
{
  "image_url": "https://example.com/receipt.jpg",
  "full_text": "COFFEE HOUSE\n123 Main Street\nTotal 12.40",
  "paragraphs": [
    {
      "text": "COFFEE HOUSE",
      "lines": [
        { "text": "COFFEE HOUSE", "center_x": 0.5, "center_y": 0.08, "width": 0.62, "height": 0.05, "angle_deg": 0.0 }
      ]
    }
  ],
  "words": [
    {
      "text": "COFFEE",
      "center_x": 0.41,
      "center_y": 0.08,
      "width": 0.22,
      "height": 0.05,
      "angle_deg": 0.0
    }
  ],
  "word_count": 6,
  "translated_text": "KOFFIEHUIS\n123 Main Street\nTotaal 12.40",
  "translate_to": "nl",
  "ocr_language": "en",
  "image_width": 1080,
  "image_height": 1920,
  "processed_in_seconds": 1.9,
  "fetched_in_seconds": 2.4
}
````

Every geometry value is normalized to the 0 to 1 range. To convert a word box back to pixels, multiply `center_x` and `width` by `image_width`, and `center_y` and `height` by `image_height`. `angle_deg` is the rotation of the box, useful for rebuilding tilted or vertical text.

### Use cases

**Document digitization.** Feed scanned pages, PDFs exported as images, or archive photos and get searchable full text with paragraph structure preserved. The line-level and paragraph-level geometry lets you reconstruct reading order and column layout instead of getting one flat blob of characters.

**Receipt and invoice extraction.** Point it at photos of receipts and invoices to pull line items, totals, dates, and vendor names. Because you get per-word bounding boxes, you can build downstream logic that reads the amount to the right of the word "Total" or groups words that sit on the same line, the spatial layer classic OCR text dumps throw away.

**Accessibility.** Generate alt text and read-aloud content from images that ship with no text alternative, including infographics, memes, screenshots, and photos of printed material. The detected language field lets you route each result to the right text-to-speech voice.

**Translation workflows.** Set `translate_to` and get the recognized text and its translation back in a single run. That covers localizing screenshots, reading foreign menus and signs, or building a "photo of text in, translated text out" pipeline without stitching an OCR service and a translation service together yourself.

### How it compares

| | This actor | zen-studio/google-lens-ocr | borderline/google-lens (OCR mode) | Google Cloud Vision OCR |
|---|---|---|---|---|
| Price per 1,000 images | **$3.99** | $4.99 | $2.50 | $1.50 |
| Actor-start fee | $0.002 / run | $0.002 / run | $0.01 / run | n/a |
| Per-item fee | none | $0.00001 / item | none | n/a |
| Word-level boxes | Yes | Yes | Partial | Yes |
| Optional translation | Yes, same run | No | No | No |
| Needs a cloud account | No | No | No | Yes (GCP + billing) |

We undercut the closest named competitor, zen-studio, by 20 percent while keeping the same low $0.002 per-run start fee and dropping the per-item fee entirely.

Being honest about the anchor: **Google Cloud Vision is cheaper per image at $1.50 per 1,000.** If you already run a Google Cloud project with billing enabled and Vision API turned on, Google's own API is the lower unit cost. The reason to choose this actor is everything around the price. There is no GCP account to create, no API key to manage, no billing setup, and no client library. You also get word-level bounding boxes and optional translation in one call, on Apify's pay-as-you-go billing you already have. For occasional or bursty workloads, the setup you skip is usually worth more than the cents you save.

### Pricing

Pay-per-event, billed through Apify:

- **$0.00399 per image processed** (the `image_ocr` event), which is **$3.99 per 1,000 images**.
- **$0.002 per run** actor-start fee.

A run over 500 images costs roughly $2.00 plus the $0.002 start fee. You only pay for images the actor actually processes. No monthly minimum, no subscription.

### Limits and gotchas

- **Direct image URLs only.** Each entry in `image_urls` must resolve straight to the image bytes. Links to a gallery page, a viewer, or an HTML wrapper will not work. If your images sit behind a page, extract the real image URL first.
- **Images are downloaded with a browser user agent.** Hosts that block hotlinking, require a login, or sit behind an aggressive WAF may refuse the fetch. Publicly reachable URLs work best.
- **Geometry is normalized 0 to 1.** Every `center_x`, `center_y`, `width`, and `height` is a fraction of the image size, not a pixel count. Multiply by `image_width` and `image_height` to get pixels.
- **Free-tier runs are capped at 10 images per run.** Upgrade to any paid Apify plan to lift the cap and process the full list.
- **The `ocr_language` hint is a nudge, not a filter.** Lens auto-detects language. Setting the hint wrong rarely breaks recognition, but it will not force the engine to read text that is not there.
- **Translation quality follows Google's own translation.** Short fragments, brand names, and heavy jargon translate less reliably than full sentences.
- **Very large or very low-resolution images can hurt accuracy.** Extremely tiny text or heavily compressed photos give the engine less to work with. Reasonable resolution helps.

### FAQ

**How do I extract text from an image without an API key?**
Paste your image URLs into the `image_urls` field and run the actor. There is no Google Cloud account, no API key, and no billing project to configure. You authenticate with your normal Apify account, and the recognized text comes back in the dataset. This is the fastest way to get an image to text API running without cloud plumbing.

**Does it return bounding boxes?**
Yes. With `include_word_boxes` on (the default), every recognized word comes back with `center_x`, `center_y`, `width`, `height`, and `angle_deg`. All values are normalized to the 0 to 1 range, so multiply by `image_width` and `image_height` to get pixel coordinates. Paragraphs and lines carry geometry too, which lets you rebuild the layout, not just the raw text.

**Can it translate the text?**
Yes. Set `translate_to` to a two-letter language code such as `en` or `nl`, and the actor returns a `translated_text` field alongside the original recognized text in the same run. Leave `translate_to` empty if you only want OCR. You do not need a separate translation API.

**What image formats and languages are supported?**
It reads JPG, PNG, WEBP, TIFF, and GIF. Because it uses the Google Lens engine, it handles a wide range of scripts including Latin, CJK (Chinese, Japanese, Korean), Cyrillic, Arabic, and Devanagari, and it copes with mixed-language images. The `ocr_language` hint is optional since Lens auto-detects.

**Is it better than Tesseract or classic OCR for photos?**
For clean, high-contrast scans, classic OCR is fine. For real-world photos, receipts, signs, screenshots, angled or handwritten text, Google Lens is markedly more robust because it was trained on that kind of input. If your source images are messy, this actor will usually recover text that a traditional engine misses.

### Related Actors

- [Google Lens](https://apify.com/s-r/google-lens) - Reverse image search: find where an image appears online plus matching products.
- [Google AI Overview](https://apify.com/s-r/google-ai-overview) - Scrape Google AI Overview answers and the sources they cite.
- [Free Google Maps Scraper](https://apify.com/s-r/free-google-maps-scraper) - Scrape Google Maps places: name, rating, phone, website, hours.

# Actor input Schema

## `image_urls` (type: `array`):

Direct URLs of images to OCR (JPG, PNG, WEBP, TIFF, GIF…). One per line, up to 200 per run.

## `ocr_language` (type: `string`):

Two-letter language hint for recognition (en, nl, de, fr, ja, zh…). Lens auto-detects, this only nudges it.

## `translate_to` (type: `string`):

Optional: translate the recognized text to this two-letter language code (e.g. 'en', 'nl'). Leave empty for OCR only.

## `include_word_boxes` (type: `boolean`):

Emit every word with its normalized geometry (center, size, rotation). Turn off for smaller output.

## Actor input object example

```json
{
  "image_urls": [
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ],
  "ocr_language": "en",
  "include_word_boxes": true
}
```

# 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 = {
    "image_urls": [
        "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
    ],
    "ocr_language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("s-r/google-lens-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 = {
    "image_urls": ["https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"],
    "ocr_language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("s-r/google-lens-ocr").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 '{
  "image_urls": [
    "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"
  ],
  "ocr_language": "en"
}' |
apify call s-r/google-lens-ocr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=s-r/google-lens-ocr",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google Lens OCR — Image to Text API",
        "description": "",
        "version": "0.1",
        "x-build-id": "VKLfFwpc7v9u7edG5"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/s-r~google-lens-ocr/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-s-r-google-lens-ocr",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/s-r~google-lens-ocr/runs": {
            "post": {
                "operationId": "runs-sync-s-r-google-lens-ocr",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/s-r~google-lens-ocr/run-sync": {
            "post": {
                "operationId": "run-sync-s-r-google-lens-ocr",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "image_urls"
                ],
                "properties": {
                    "image_urls": {
                        "title": "Image URLs",
                        "type": "array",
                        "description": "Direct URLs of images to OCR (JPG, PNG, WEBP, TIFF, GIF…). One per line, up to 200 per run.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "ocr_language": {
                        "title": "OCR language hint",
                        "type": "string",
                        "description": "Two-letter language hint for recognition (en, nl, de, fr, ja, zh…). Lens auto-detects, this only nudges it.",
                        "default": "en"
                    },
                    "translate_to": {
                        "title": "Translate to",
                        "type": "string",
                        "description": "Optional: translate the recognized text to this two-letter language code (e.g. 'en', 'nl'). Leave empty for OCR only."
                    },
                    "include_word_boxes": {
                        "title": "Include word-level bounding boxes",
                        "type": "boolean",
                        "description": "Emit every word with its normalized geometry (center, size, rotation). Turn off for smaller output.",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
