Google Lens OCR API - Image to Text & Coordinates
Pricing
from $2.99 / 1,000 ocrs
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
Maintained by CommunityActor stats
0
Bookmarked
4
Total users
4
Monthly active users
8 days ago
Last modified
Categories
Share
An image to text API powered by Google Lens OCR. Paste an image URL, a screenshot, a scan, a manga page, an invoice, and get the text back as JSON with bounding box coordinates for every word, line, and paragraph. 0.5 to 1 second per image. No Google Cloud project, no API key to manage.
Google offers no official Lens API; this actor is the programmatic way to use Lens OCR. The coordinates are what separate it from a text dump: overlay a translation onto the original image, black out personal data, build a searchable PDF, or map a form label to the value sitting beside it. Looking for where an image appears online instead? That's the Reverse Image Search API; this one reads text only.
๐ How to extract text from an image
- Paste one or more image URLs into Image URLs. JPEG, PNG, WebP, and GIF all work.
- Optional: open ๐ Translation & language and pick a Translate to language.
- Click Start.
- Open the Output tab and click Export for JSON, CSV, Excel, or HTML.
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 process in parallel, so a batch costs little more wall time than its slowest image.
๐ So what do you get?
| ๐ Extracted text | ๐ฆ Boxes for every word, line, and paragraph | ๐ Detected language |
|---|---|---|
| ๐ Built-in translation | ๐งญ Writing direction per paragraph | โ Math formulas as LaTeX |
| ๐ฏ Detected objects and salient regions | ๐ Pixel and normalized coordinates | ๐ Rotation angle per box |
| #๏ธโฃ Word, line, and paragraph counts | ๐ผ๏ธ Image dimensions | ๐ซ Failed URLs logged, never billed |
โ๏ธ Compared to Cloud Vision and Tesseract
| This actor | Google Cloud Vision | Tesseract | |
|---|---|---|---|
| Line bounding boxes | โ | โ Words and paragraphs only | โ |
| Coordinates | โ Pixel and normalized | โ ๏ธ Pixels only | โ ๏ธ Pixels only |
| Writing direction per paragraph | โ | โ | โ |
| Math as LaTeX | โ | โ | โ |
| Translation | โ Built in | โ Separate Translate API | โ |
| Objects and salient regions | โ Included | โ ๏ธ Separate feature, billed per call | โ |
| Accuracy on photos and angled text | โ Strong | โ Strong | โ ๏ธ Weak |
| Setup | โ Register on Apify, $5 free monthly credit | โ GCP project, billing, API key | โ ๏ธ Install and self-host |
Cloud Vision has no line level and no translation, and you need a GCP project, billing, and an API key before your first request. 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.
๐ฏ Three things people run this for
| How | |
|---|---|
| ๐ด Manga and comic translation | Set translateTo, get each speech bubble's text, box, and writing_direction. Vertical Japanese comes back correctly ordered, ready to render the translation in place |
| ๐ถ๏ธ Redaction before storage | Find the name or card number, take its word-level pixel box, black it out. OCR becomes a PII-removal step in your pipeline |
| ๐งพ Invoice and form extraction | A label means nothing until you know which value sits next to it. Boxes give you the spatial layout, so Total due maps to $99.50 instead of a guess from reading order |
๐ฅ Input
{"imageUrls": ["https://example.com/screenshot.png"],"translateTo": "en"}
imageUrls: images to extract text from, as many as you liketranslateTo: ISO 639-1 target language. Empty = no translationlanguage: defaulten. A hint for the text in the image, not a filterregion: defaultUS. Locale hint for region-specific formatting
In the Console, the last three sit under the collapsible ๐ Translation & language section.
๐ก Tip: send the largest version of the image you have; text under roughly 15 pixels tall is unreliable. For non-Latin scripts, setting
languagemeasurably improves accuracy on Japanese, Arabic, Thai, and Cyrillic.
๐ค Output
One dataset row per image. Failed images are never charged and never appear in the dataset; the failed URLs and reasons land in the FAILURES record of 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,"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// HIDDEN: translation (when translateTo is set), image_size_bytes,// word type and latex fields, line-level bounding boxes}
Fields
| Field | Description |
|---|---|
text | Full extracted text, paragraphs separated by blank lines |
language | Detected language of the text |
paragraphs[] | 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 boxes. Populated even when the image has no text, so a blank result is still a real result |
translation | Translated text plus detected source language, when translateTo is set |
paragraph_count, line_count, word_count | Counts for quick filtering |
image_width, image_height, image_size_bytes | Source image properties |
Every bounding_box carries normalized coordinates (x, y, width, height, center_x, center_y, rotation) plus a pixels object with the same box in image pixels. Use pixels for cropping and drawing, the normalized values if you resize afterwards.
โ๏ธ Use it as an image to text API
Every run is an HTTP endpoint: POST the same JSON as the form and the records come back in the response body, usually within seconds.
Python
import requestsresp = requests.post("https://api.apify.com/v2/acts/thodor~google-lens-ocr/run-sync-get-dataset-items",params={"token": "YOUR_APIFY_TOKEN"},json={"imageUrls": ["https://example.com/screenshot.png"], "translateTo": "en"},)for item in resp.json():print(item["text"])
Node.js
import axios from "axios";const { data } = await axios.post("https://api.apify.com/v2/acts/thodor~google-lens-ocr/run-sync-get-dataset-items",{ imageUrls: ["https://example.com/screenshot.png"] },{ params: { token: process.env.APIFY_TOKEN } });console.log(data[0].text, data[0].word_count);
curl
curl -X POST "https://api.apify.com/v2/acts/thodor~google-lens-ocr/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \-H "Content-Type: application/json" \-d '{"imageUrls":["https://example.com/screenshot.png"]}'
Swap run-sync-get-dataset-items for runs to fire async with a webhook when you batch thousands of images. The apify-client SDK works too, in Python and JavaScript, and the n8n, Make, and Zapier integrations take the same input.
๐ก Tip: no need to write the JSON by hand. Fill in the form on the Input tab, switch the editor from Form to JSON, and copy the result into your code.
๐ฐ How much does OCR cost?
Billing is per image processed, at the rate on the price card on this page. No subscription, no monthly minimum, no per-run start fee. Images that fail are not charged.
โ FAQ
Is there an official Google Lens API? No, Google has never published one. Cloud Vision is a different engine with different output. This actor drives Lens itself and returns its results as JSON.
Can I use this image to text API for free? Yes. Registering on Apify comes with $5 of free platform credit every month, no credit card needed, enough for roughly 1,250 images at current rates.
How accurate is Google Lens OCR? Very good on printed text, including photos taken at an angle, and strong on non-Latin scripts. Low resolution, heavy compression, and stylised fonts reduce accuracy. Handwriting works partially: neat sometimes, cursive generally not.
What languages are supported? Lens detects the language automatically and handles more than 100, including right-to-left scripts like Arabic and Hebrew and vertical Japanese.
What image formats work? JPEG, PNG, WebP, and GIF. Animated GIFs are read as their first frame. If your host serves AVIF or HEIC, convert first.
Is OCR on images legal? Extracting text from images you are entitled to process is ordinary data processing. What matters is what the images contain and what you do with the results; if they hold personal data, GDPR or CCPA applies to you.
๐ Support
Something not working, or a field missing? Message me in the Issues tab and I'll look into it quickly. I'm a solo dev, so don't hesitate.
Need to find where an image appears online instead of what it says? The Reverse Image Search API covers that side.
- Thodor
