Google Lens OCR API - Image to Text & Coordinates avatar

Google Lens OCR API - Image to Text & Coordinates

Pricing

from $2.99 / 1,000 ocrs

Go to Apify Store
Google Lens OCR API - Image to Text & Coordinates

Google Lens OCR API - Image to Text & Coordinates

Google Lens OCR API. Extract text from images with word, line and paragraph bounding boxes in pixels, plus object detection and translation.

Pricing

from $2.99 / 1,000 ocrs

Rating

0.0

(0)

Developer

Thodor

Thodor

Maintained by Community

Actor stats

0

Bookmarked

3

Total users

2

Monthly active users

2 days ago

Last modified

Share

What does Google Lens OCR API - Image to Text & Coordinates do?

This actor is an image to text API powered by Google Lens OCR. Give it any image URL — a screenshot, a photo, a scan, a manga page, an invoice — and it returns the extracted text together with bounding box coordinates for every word, line and paragraph, the detected language, and the objects Lens found in the picture. Google offers no official Lens API — this actor is the programmatic way to use Lens OCR.

Most OCR tools give you a wall of text and leave you guessing where any of it came from. The coordinates are what make the output usable: they let you overlay a translation back onto the original image, black out personal data, build a searchable PDF, or map a form label to the value sitting next to it.

It is a clean, JSON-first OCR API for developers. Try it from the Apify Console, call it from the Apify API, schedule it, or wire it into n8n, Zapier, Make, or your own pipeline.

How fast is this OCR API?

Typically 0.5 to 1 second per image. Measured on real images: a 900x300 PNG returned in 566 ms, an 800x400 PNG in 642 ms, and a 2878x1918 JPEG photo in 766 ms, each including the time to download the source file.

Images are processed in parallel, so a batch costs little more than the slowest image in it.

Looking for reverse image search instead? This actor does text only. If you want to find where an image appears online — every page carrying it, plus the original source image URL — use Reverse Image Search API - Google Lens.

Why use this Google Lens OCR API?

  • Coordinates at three levels. Bounding boxes for every word, every line and every paragraph — not just words. Returned in normalized form, centre form, and pixels, so you never have to redo the maths.
  • Objects and salient regions, not just text. Lens also reports the objects it detects and the visually important region of the image. Useful for smart cropping and subject detection, and returned even when an image contains no text at all.
  • Built-in translation. Set a target language and get the translated text back alongside the original, with the source language detected automatically.
  • Right-to-left and vertical scripts. Each paragraph carries its own writing_direction and language, so Arabic, Hebrew and vertical Japanese come back correctly ordered rather than scrambled.
  • Math as LaTeX. Words recognised as formulas are flagged and, where Lens provides it, returned as LaTeX.
  • Fast and cheap to run. Images are processed in parallel and a run costs little more than the wall time of the slowest image.

What the bounding boxes are for

This is the part that separates a usable OCR API from a text dump.

Translation overlay. To render a translation back into a manga speech bubble, a comic panel, or a photographed sign, you need to know exactly where the original text sat. Word and line boxes plus writing_direction give you that, including vertical Japanese.

Redaction and PII removal. Find the text, get its box, black it out. Coordinates turn OCR into an image redaction step you can run before storing or sharing a document.

Searchable PDFs. A scan becomes searchable by laying an invisible text layer over the image at the right coordinates. Without boxes you cannot position that layer.

Forms, invoices and tables. Spatial relationships are the whole game in document data extraction — a label means nothing until you know which value sits to the right of it, or which cell shares a row.

Screenshot and UI automation. Locate a button or a field by its text, then act on its pixel coordinates.

Smart cropping. The salient-region and detected-object boxes tell you where the subject of a photo is, which is what you want when generating thumbnails.

How to use this image to text API

  1. Open the actor in the Apify Console.
  2. Paste one or more image URLs into the Image URLs field. JPEG, PNG, WebP and GIF all work.
  3. Optionally open 🌍 Translation & language and pick a Translate to language from the dropdown.
  4. Click Start, then download the dataset as JSON, CSV, Excel or HTML.

Image to text API example — Python

from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("thodor/google-lens-ocr").call(run_input={
"imageUrls": ["https://example.com/screenshot.png"],
"translateTo": "en",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["text"])
for para in item["paragraphs"]:
for line in para["lines"]:
print(line["text"], line["bounding_box"]["pixels"])

Image to text API example — JavaScript

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('thodor/google-lens-ocr').call({
imageUrls: ['https://example.com/screenshot.png'],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((i) => console.log(i.text, i.word_count));

Input

FieldTypeRequiredDescription
imageUrlsarray of URLsyesImages to extract text from
translateTostringnoISO 639-1 target language. Leave empty to skip translation
languagestringno (default en)ISO 639-1 hint for the text in the image
regionstringno (default US)ISO 3166-1 alpha-2 hint for locale-specific formatting

In the Apify Console, translateTo, language and region sit under the collapsible 🌍 Translation & language section as searchable dropdowns.

Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel, or read it as a spreadsheet directly from the Apify Console.

Google Lens OCR API output in the Apify Console: one dataset row per image with the extracted text, word, line and paragraph counts, detected language and detected objects

Each input image becomes one dataset row: the extracted text, word / line / paragraph counts, detected language and detected objects — as it appears in the Apify Console.

One dataset record per successfully processed image. Failed images are never charged and never appear in the dataset — each failure is logged, and the failed URLs with the reason are saved to the FAILURES record in the run's key-value store.

{
"image_url": "https://example.com/invoice.png",
"text": "Invoice 12345\n\nTotal due $99.50",
"language": "en",
"paragraph_count": 2,
"line_count": 2,
"word_count": 6,
"paragraphs": [
{
"text": "Invoice 12345",
"language": "en",
"writing_direction": "LEFT_TO_RIGHT",
"bounding_box": {
"x": 0.2489, "y": 0.2499, "width": 0.5011, "height": 0.19,
"center_x": 0.4994, "center_y": 0.3449, "rotation": 0.0,
"coordinate_type": "NORMALIZED",
"pixels": { "x": 224, "y": 75, "width": 451, "height": 57 }
},
"lines": [
{
"text": "Invoice 12345",
"words": [
{ "text": "Invoice", "separator": " ", "bounding_box": { "pixels": { "x": 224, "y": 75, "width": 227, "height": 57 } } }
]
}
]
}
],
"objects": [
{ "id": "SalientRegion-Top", "kind": "salient_region",
"bounding_box": { "pixels": { "x": 178, "y": 70, "width": 547, "height": 154 } } }
],
"image_width": 900,
"image_height": 300
}

Data fields

FieldDescription
image_urlThe image that was processed
textFull extracted text, paragraphs separated by blank lines
languageDetected language of the text
paragraph_count / line_count / word_countCounts for quick filtering
paragraphs[]Paragraph objects, each with text, language, writing_direction, bounding_box and lines[]
paragraphs[].lines[].words[]Each word with text, separator, bounding_box, type, and latex when it is a formula
objects[]Detected objects and salient regions with bounding boxes
translationTranslated text with source and target language, when translateTo is set
image_width / image_height / image_size_bytesSource image properties

Every bounding_box carries both normalized coordinates (x, y, width, height, plus center_x / center_y and rotation) and a pixels object with the same box in image pixels.

Use cases for image to text and OCR

Manga translator and comic translator workflows. Extract Japanese, Korean or Chinese text from a page, get the box for each speech bubble, translate it, and render the result back in place. writing_direction handles vertical text correctly, which is what makes a manga translator workable rather than a scrambled mess.

Screenshot to text. Extract text from screenshots at scale — support tickets, chat logs, error messages, dashboards — instead of retyping them.

Invoice OCR and receipt scanning. Extract line items, totals and dates from scanned documents. Coordinates let you map each label to the value beside it rather than guessing from reading order.

Document data extraction and table parsing. Reconstruct table structure from cell positions, and pull structured fields out of forms.

Image redaction and PII removal. Locate names, addresses, card numbers or ID numbers and use their boxes to black them out before the image is stored or shared.

Searchable PDF creation. Lay an invisible, correctly positioned text layer over a scanned page so it becomes searchable.

Accessibility and reading order. Use paragraph geometry and writing direction to reconstruct a sensible reading sequence for screen readers.

Smart cropping and thumbnails. Use the salient-region box to crop around the subject instead of the centre of the frame.

Google Lens OCR vs Cloud Vision API vs Tesseract

This actorGoogle Cloud VisionTesseract
Extracted textyesyesyes
Detected languageautomaticautomaticset manually
Word bounding boxesyesyesyes
Line bounding boxesyesno — words and paragraphs onlyyes
Paragraph bounding boxesyesyesyes
Pixel and normalized coordinatesbothpixels onlypixels only
Rotation angle per boxyescorner points onlyno
Detected objects & salient regionsyesseparate feature, billed per callno
Writing direction per paragraphyesnono
Math formulas as LaTeXyesnono
Built-in translationyesno — separate Translate APIno
Accuracy on photos & angled textstrongstrongweak
Setuppaste an image URLGCP project, billing, API keyinstall and self-host

Cloud Vision is cheaper per image at scale, but you need a GCP project, billing and an API key before your first request, and there is no line level and no translation. Tesseract is free, but you host it yourself, feed it the language up front, and accuracy drops sharply on photographs. This actor is an image URL in, JSON out.

The object and salient-region boxes are the unusual one: they are returned even when an image contains no text at all, so a blank image still produces a meaningful record.

How much does OCR cost?

Pay-per-result pricing: you pay per image processed, with no subscription, no monthly minimum and no per-run start fee. Apify's free plan includes $5 of platform credit every month, which is enough to trial this comfortably. Images that fail are not charged. See the Pricing tab for current rates.

Tips and advanced options

  • Send the largest version of the image you have. OCR accuracy falls off quickly on small or heavily compressed images; text under roughly 15 pixels tall is unreliable.
  • Set language when the text is not Latin script. It is a hint, not a filter, and it measurably improves accuracy on Japanese, Arabic, Thai and Cyrillic.
  • Coordinates are normalized and pixel. Use pixels for cropping and drawing; use the normalized values if you plan to resize the image afterwards.
  • Schedule it. Use Apify Schedules and Webhooks to OCR new images automatically as they arrive.

FAQ

Is this Google Lens OCR API free to try? Yes — you can try it for free, no credit card required. Apify's free plan includes $5 of platform credit every month, enough for roughly 1,250 images at current rates.

How accurate is Google Lens OCR? Very good on printed text in reasonable lighting, including photos taken at an angle, and strong on non-Latin scripts. Handwriting, very low-resolution images, heavy compression artefacts and stylised display fonts all reduce accuracy.

What languages are supported? Lens detects the language automatically and handles more than 100, including right-to-left scripts such as Arabic and Hebrew and vertical Japanese. You can supply a language hint to improve accuracy.

Can it translate the text it finds? Yes. Set translateTo to a language code and the output includes a translation object with the translated text plus the detected source language.

Does it return coordinates for the text? Yes, for every word, line and paragraph, in both normalized and pixel form, with a rotation value for text that is not horizontal.

Can it read handwriting? Partially. Neat handwriting sometimes works; cursive and messy handwriting generally does not. This is a limitation of the underlying recognition, not of the actor.

What image formats work? JPEG, PNG, WebP and GIF. Animated GIFs are treated as their first frame. If your image host serves AVIF or HEIC by content negotiation, convert it first.

Is OCR on images legal? Extracting text from images you own or are otherwise entitled to process is ordinary data processing. What matters is what the images contain and what you do with the results — if you process documents containing personal data, handle the output under whatever privacy rules apply to you, such as GDPR or CCPA.

Can this find where an image appears online? No — this actor reads text out of images and nothing else. For reverse image search, exact matches and the original source image URL of every page using a picture, use Reverse Image Search API - Google Lens instead. The two are deliberately separate: OCR finishes in under a second, while reverse image search is a heavier job with different pricing.

Why did an image return no text? Either it genuinely contains none, or the text is too small, too low-contrast, or too distorted to recognise. The objects array is still populated in that case, so a blank result is still a real result. Images that fail outright (unreachable URL, unsupported format) are not charged and don't appear in the dataset — the run log and the FAILURES record in the key-value store list them with the reason.


Last updated: July 2026.