# Google Lens (`danielmilevski9/google-lens`) Actor

Google Lens API alternative with no limits. Use this OCR shortcut to recognize text on the image, find alt text, identify language, recognize image type, find similar products and visuals by image URL. Just copy-paste an image URL you need OCR data from.

- **URL**: https://apify.com/danielmilevski9/google-lens.md
- **Developed by:** [Daniel Milevski](https://apify.com/danielmilevski9) (community)
- **Categories:** E-commerce
- **Stats:** 544 total users, 1 monthly users, 100.0% runs succeeded, 12 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 images

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 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

This Actor is an unofficial Google Lens API capable to **identify text on images, recognize objects on images even without text, and search by images**. Provided with an image URL, this Google Lens API will extract the image type, an array of OCR text fragments, locale, and optional site links for visual matches.

### What is a Google Lens Actor and what does it do?

It does pretty much the same thing as Google Lens itself except it also provides you with programmatic access to the results, namely the results of:

🔍 OCR, text and alt text recognition, and translation

🎁 Object recognition and classification

🕵️‍ Reverse image search

📚 Converting images into text

💽 Double use as Google Lens API

### How do I get OCR data from Google Lens?

1. [Create](https://console.apify.com/sign-up) a free Apify account using your email.
2. Open [Google Lens Actor](https://apify.com/alexey/google-lens).
3. Find an image link.
4. Feed the image link to the Actor.
5. Click "Start" and wait for the data to be extracted and matched.
6. Download your Google Lens data in JSON, XML, CSV, Excel, or HTML.

If you need guidance on how to run the scraper, you can follow our [step-by-step tutorial](https://blog.apify.com/google-lens-api-ocr-text-image-search/) 🔗

### How can I use Google Lens Actor?

🦾 Bootstrap AI training with image datasets

🪞 Find similar products and visuals

✨ Support creative work such as graphic or web design

🔦 Detect specific content across the web

### Input example

The input for Google Lens API should be **an image URL you need OCR data from**. The image can be from anywhere on the web: blog, newspaper, e-shop, social media posts such as Instagram or Twitter, etc. You can add one or multiple image URLs with an image format at the end such as .png or .jpg. See the [input tab](https://apify.com/alexey/google-lens/api) for a full explanation of input in JSON.

```jsx
{
    "startUrls": [
        { "url": "https://hips.hearstapps.com/hmg-prod/images/two-glasses-of-wine-and-summer-fruits-on-the-beach-royalty-free-image-1635272439.jpg" },
        { "url": "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDXLWcWMSy7iTEEmJZmwDG7mzCXNjB0NJ-M33XyIPmEHu7EAN7NTQF6wrxI5O895zmRo9KReAAi2eoeQFE_W6WqmCc-IeKa9L2wCJ9fyijXwLlYzNQAv3BMRK0yQmqQbG_g3wbg1tTcsWO-AGH6TRtcA1ZXYT102FGAngVS9KHNXBvcYuUT6I77cYt/s4032/SeoulProSoyFront.JPG" }
    ],
    "addMatchedImageSources": true
}
```

### Output example

The results will be wrapped into a dataset which you can find in the **Storage** tab. You can choose in which format to download your Google Lens data: JSON, JSONL, Excel spreadsheet, HTML table, CSV, or XML.

#### Images containing text

If the image has text on it, you can easily get all the OCR data. Moreover, if your image includes a product type known to Google Lens, you will get a short `imageType` description:

<img width="50%" src="https://www.maisonmargiela-fragrances.eu/dw/image/v2/BDCR_PRD/on/demandware.static/-/Sites-margiela-master-catalog/default/dw3fbc4479/images/products/MM003/MM003_002.jpg" />  

```jsx
[{
  "url": "https://www.maisonmargiela-fragrances.eu/dw/image/v2/BDCR_PRD/on/demandware.static/-/Sites-margiela-master-catalog/default/dw3fbc4479/images/products/MM003/MM003_002.jpg?sw=750&sh=750&sm=cut&sfrm=jpg&q=70",
  "imageType": "MAISON MARGIELA Replica Eau De Toilette Spray",
  "ocrTextLocale": "en",
  "ocrText": [
    "Musc",
    "REPLICA",
    "REPRODUCTION OF FAMILIAR SCENTS AND MOMENTS OF VARYING LOCATIONS AND PERIODS",
    "Originally:",
    "Beach Walk",
    "Calvi 1972",
    "Provenance and Period:Fragrance Description:Style Description:",
    "Sun kissed salty skin",
    "Female fragrance",
    "Maison Margiela PARIS",
    "Bergamot",
    "Coconut Milk",
    "Ylang Ylang"
  ],
  "matchesCount": 42
}]
```

#### Images containing no text

In case there is no text on the image to be scanned and referred to, you might still get an `imageType` in description if it is known to Google Lens.

<img width="50%" src="https://hips.hearstapps.com/hmg-prod/images/index1-1605618242.jpg" />   

```jsx
{
	"url": "https://hips.hearstapps.com/hmg-prod/images/index1-1605618242.jpg",
	"imageType": "Pierce Brosnan",
	"matchesCount": 60
}

```

#### Image matches found

Sometimes the `imageType` cannot be identified. In that case, you can also search for visual matches without spending extra CUs. However, please note that the resulting matches wouldn't be direct image links but thumbnails, a.k.a static images generated by Google. You can use the matched images as a reference or as a wide guess for cases when the image can not be recognized as specific type.

<img width="50%" src="https://blog.apify.com/content/images/size/w600/2023/03/Screenshot-2023-03-20-at-17.01.39-1.png" />  

```javascript
{
  "url": "https://blog.apify.com/content/images/size/w600/2023/03/Screenshot-2023-03-20-at-17.01.39-1.png",
  "imageType": "Unknown Type",
  "matchesCount": 60,
  "matches": [
    {
      "thumb": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTLT_m1JfUJQp4UY_HfbAFOMJleG7gxh88GHoDZuQgjhBo858gD",
      "websiteTitle": "Coming soon: National Opportunity Zones Marketplace - Smart Growth America",
      "websiteUrl": "https://smartgrowthamerica.org/coming-soon-national-opportunity-zones-marketplace/"
    },
    {
      "thumb": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQinUS15ZYiWRAv8E46mcoYelLBej6nkyA9hVwikCqJzoim0KKp",
      "websiteTitle": "Zones (green) and corridors (red lines) of clusters of inner city... | Download Scientific Diagram",
      "websiteUrl": "https://www.researchgate.net/figure/Zones-green-and-corridors-red-lines-of-clusters-of-inner-city-biophilic-elements-in_fig2_337842964"
    },
    {
      "thumb": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSsoteufMUU8fSATFX6TuInnLbUlD_FlocAmUMe1F915z6gyTsm",
      "websiteTitle": "Climate Change and The Greenway - The Rose Kennedy Greenway",
      "websiteUrl": "https://www.rosekennedygreenway.org/climate-change-and-the-greenway/"
    },
    {
      "thumb": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQsxZhcKPyZLqJbrRuGkt23zHm_naRzeXPJlgYbwyWa2SoZ9EnN",
      "websiteTitle": "Archive: Governor Andrew Cuomo on Twitter: \"We have a clear and effective plan to respond to any clusters that threaten our progress. We will attack each area in the cluster with appropriate restrictions. Here is the map of the Brooklyn cluster along with the rules. https://t.co/xdV84gcQJg\" / Twitter",
      "websiteUrl": "https://twitter.com/NYGovCuomo/status/1313588620264124416"
    },
    {
      "thumb": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRQ59PgMbOgex0LAFBVw4GKkjzdHt0oZ6RMliw6eRogTDZow7BD",
      "websiteTitle": "(PDF) Predicting Taxi and Uber Demand in Cities: Approaching the Limit of Predictability",
      "websiteUrl": "https://www.researchgate.net/publication/337876513_Predicting_Taxi_and_Uber_Demand_in_Cities_Approaching_the_Limit_of_Predictability"
    }
  ]
}
```

### Need more Google scraping tools?

You can use the dedicated scrapers below if you want to scrape specific Google data. Each of them is built particularly for the relevant Google scraping case be it Maps, Trends, Reviews, or Google Search itself. Feel free to browse them:

<table>
<tr>
<td>🗺 <a href="https://apify.com/lukaskrivka/google-maps-with-contact-details">Google Maps with Contact Details</a></td>
<td>🎮 <a href="https://apify.com/epctex/google-play-scraper">Google Play Scraper</a></td>
</tr>
<tr>
<td>🔍 <a href="https://apify.com/apify/google-search-scraper">Google Search Results Scraper</a></td>
<td>📈 <a href="https://apify.com/emastra/google-trends-scraper">Google Trends Scraper</a></td>
</tr>
<tr>
<td>💼 <a href="https://apify.com/dan.scraper/google-jobs-scraper">Google Jobs Scraper</a></td>
<td>📰 <a href="https://apify.com/lhotanok/google-news-scraper">Google News Scraper</a></td>
</tr>
<tr>
<td>📍 <a href="https://apify.com/compass/crawler-google-places">Google Maps Scraper</a></td>
<td>🤖 <a href="https://apify.com/geneea/reviews-text-nlp-analyzer">AI Text Analyzer for Google Reviews</a></td>
</tr>
</table>

### Is it legal to scrape Google Lens data?

Our Google scrapers are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. However, you should be aware that your results could contain personal data. You should not scrape personal data unless you have a legitimate reason to do so.
If you're unsure whether your reason is legitimate, consult your lawyers. You can also read our blog post on the legality of [web scraping](https://blog.apify.com/is-web-scraping-legal/) and [ethical scraping](https://blog.apify.com/what-is-ethical-web-scraping-and-how-do-you-do-it/).

### Your feedback

We’re always working on improving the performance of our Actors. So if you’ve got any technical feedback for Google Lens Scraper or simply found a bug, please create an issue on the Actor’s [Issues tab](https://console.apify.com/actors/RA7fg2mqciGjZM7hM/issues) in Apify Console.

# Actor input Schema

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

Provide direct urls of images

## `addMatchedImageSources` (type: `boolean`):

For visual matches no direct image links available, only generated thumbnail, site title and site URL

## `proxy` (type: `object`):

Either use an Apify proxy, or provide your own proxy servers.

## `maxRequestRetries` (type: `integer`):

Try to find retries and concurrency to get best output for your image sources

## `debugLog` (type: `boolean`):

Enable a more verbose logging to be able to understand what's happening during the scraping.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://hips.hearstapps.com/hmg-prod/images/two-glasses-of-wine-and-summer-fruits-on-the-beach-royalty-free-image-1635272439.jpg"
    },
    {
      "url": "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDXLWcWMSy7iTEEmJZmwDG7mzCXNjB0NJ-M33XyIPmEHu7EAN7NTQF6wrxI5O895zmRo9KReAAi2eoeQFE_W6WqmCc-IeKa9L2wCJ9fyijXwLlYzNQAv3BMRK0yQmqQbG_g3wbg1tTcsWO-AGH6TRtcA1ZXYT102FGAngVS9KHNXBvcYuUT6I77cYt/s4032/SeoulProSoyFront.JPG"
    }
  ],
  "proxy": {
    "useApifyProxy": true
  },
  "maxRequestRetries": 10,
  "debugLog": false
}
```

# 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://hips.hearstapps.com/hmg-prod/images/two-glasses-of-wine-and-summer-fruits-on-the-beach-royalty-free-image-1635272439.jpg"
        }
    ],
    "proxy": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("danielmilevski9/google-lens").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://hips.hearstapps.com/hmg-prod/images/two-glasses-of-wine-and-summer-fruits-on-the-beach-royalty-free-image-1635272439.jpg" }],
    "proxy": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("danielmilevski9/google-lens").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://hips.hearstapps.com/hmg-prod/images/two-glasses-of-wine-and-summer-fruits-on-the-beach-royalty-free-image-1635272439.jpg"
    }
  ],
  "proxy": {
    "useApifyProxy": true
  }
}' |
apify call danielmilevski9/google-lens --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/RA7fg2mqciGjZM7hM/builds/KiCOToPciJcqlOpoS/openapi.json
