# Image Comparator: Image Similarity Score & Duplicate Finder (`zaiq/image-comparator`) Actor

Compare images by link or base64 and get a 0-1 visual similarity score from a deep-learning model, plus a perceptual-hash distance and a colour match. One image against many, or find duplicate groups in a whole set. For product matching, copy detection and dedupe. No AI key needed.

- **URL**: https://apify.com/zaiq/image-comparator.md
- **Developed by:** [Zaiq](https://apify.com/zaiq) (community)
- **Categories:** AI, E-commerce, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 compared images

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Image Comparator API: image similarity score, perceptual hash and duplicate finder

![Image Comparator: Image Similarity Score & Duplicate Finder](https://api.apify.com/v2/key-value-stores/4VJNANhwKgqPpXtAi/records/hero-image-comparator.jpg)

Compare images by **link or base64** and get a **0-1 visual similarity score** from a **deep-learning model** (DINOv2), a **perceptual-hash distance** (exact and resized copies) and a **colour match** for every pair. Give **source images** to score each target against them, or leave the sources empty to find **duplicate groups** across a whole set.

Built for **e-commerce product matching** (is this listing the same product photo?), **copy and reuse detection**, **catalogue and photo-library dedupe**, and **AI agents** that need a yes/no on two pictures. Everything runs inside the Actor: **no AI key, no account, no upload to another service**. From **$0.40 per 1,000 images**.

### What you get

| Field | What it holds |
|---|---|
| Scores | `similarity` (0-1, deep-learning), `hashDistance` (0-64 bits) and `hashSimilarity`, `colorSimilarity` (0-1), `identicalFile` |
| Verdict | `verdict`: identical file, same picture, near duplicate, similar or different; `isMatch` against your threshold |
| Match | `bestMatch`, `bestMatchIndex`, and `matches` (every source with its scores) when you give several sources |
| Duplicates mode | `groupId`, `groupSize`, `duplicateOf` (the first image of its group) |
| Image facts | `width`, `height`, `format`, `bytes`, `sha256`, `status`, `error`, `downloadedVia` |

### What people use it for

- **Product matching:** check whether a marketplace listing uses the same photo as your catalogue
- **Copy detection:** find where your images were reused, resized, cropped or recompressed
- **Catalogue dedupe:** group duplicate product photos before an import
- **Photo libraries:** find the same picture saved many times under different names
- **Price intelligence:** join products across shops by their images when titles differ
- **AI agents:** a similarity score for two pictures inside any workflow

### How to use it

1. Put the images to compare against in **Source images** (or leave it empty to find duplicates).
2. Put the images to check in **Target images**: links or base64.
3. Click **Start**. Each target gets one row with its best match and scores.

### Input

| Field | Example | Notes |
|---|---|---|
| Source images | `https://example.com/product.jpg` | Up to 100; the first 10 are free |
| Target images | `https://example.com/listing-photo.jpg` | Links or base64, up to 10,000 (5,000 for duplicates) |
| Match threshold | `0.8` | 0.9 for near-identical copies only; 0.6 to also catch most other photos of the same object |
| Ignore colour | off | Greyscale comparison |
| Download headers | `{"Referer": "https://example.com/"}` | Optional, for image servers that ask for one |

### Output

Each result is one row in the run's dataset (download it as JSON, CSV, Excel, XML or HTML, or read it through the API). An example row (values shortened):

```json
{
  "mode": "compare",
  "image": "https://example.com/images/listing-photo-small.jpg",
  "index": 0,
  "width": 320,
  "height": 240,
  "format": "jpeg",
  "bytes": 16368,
  "sha256": "c5a2456ed47fa0ab33764da62b38ed32a76ba69ae2a04318596299ead468b339",
  "bestMatch": "https://example.com/images/catalogue-photo.jpg",
  "bestMatchIndex": 0,
  "similarity": 0.9702,
  "hashDistance": 0,
  "hashSimilarity": 1.0,
  "colorSimilarity": 0.9313,
  "identicalFile": false,
  "verdict": "same picture",
  "isMatch": true,
  "threshold": 0.8,
  "matches": null,
  "status": "ok",
  "downloadedVia": "direct",
  "checkedAt": "2026-11-07T10:07:56Z"
}
```

A record named `SUMMARY` in the run's key-value store says what each input returned, with any notes (for example an account that does not exist), what was charged and how much traffic the run used.

### Pricing

- **$0.0005 per compared image** ($0.50 per 1,000), **$0.40 per 1,000 on Gold and above**
- Up to 10 source images per run are free
- Images that cannot be downloaded or read are free
- Apify's $0.00005 start charge counts towards your Maximum cost per run.

What typical jobs cost at the list price:

| Job | Cost |
|---|---|
| One image against one source | $0.0005 |
| 100 listing photos against your product photo | $0.05 |
| 1,000 images checked for duplicates | $0.50 |
| 10,000 catalogue images against 5 reference photos | $5 ($4 on Gold) |

On Apify's Scale and Business plans the per-event prices are lower (Store discounts). Set **Maximum cost per run** and the Actor stops cleanly when it is reached: you never pay more than that.

### Tips

- Start with a threshold of 0.8, then read a few rows. In our tests, edited copies (resized, recompressed, cropped to 60%, rotated, mirrored or watermarked) scored 0.89 to 0.99; other photos of the same landmark 0.44 to 0.91 (median 0.74); unrelated photos 0 to 0.30.
- `hashDistance` of 0 to 4 means the same picture whatever the size; the row then says `same picture` even if the threshold is high.
- Turn on Ignore colour to match the same design in another colourway.
- Give several source images (front, back, side) to match a product however it was photographed: `matches` lists every one.

### Use it through the API

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("zaiq/image-comparator").call(run_input={"sourceImages": ["https://example.com/catalogue-photo.jpg"], "targetImages": ["https://example.com/listing-photo-1.jpg", "https://example.com/listing-photo-2.jpg"], "threshold": 0.8})
for row in client.dataset(run.default_dataset_id).iterate_items():
    print(row)
```

**JavaScript**

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('zaiq/image-comparator').call({"sourceImages": ["https://example.com/catalogue-photo.jpg"], "targetImages": ["https://example.com/listing-photo-1.jpg", "https://example.com/listing-photo-2.jpg"], "threshold": 0.8});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**HTTP (one call, results back)**

```bash
curl -X POST 'https://api.apify.com/v2/acts/zaiq~image-comparator/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"sourceImages": ["https://example.com/catalogue-photo.jpg"], "targetImages": ["https://example.com/listing-photo-1.jpg", "https://example.com/listing-photo-2.jpg"], "threshold": 0.8}'
```

### Integrations and schedules

- **Schedules:** run it every hour, day or week from the Apify Console (Schedules) and keep a history of results.
- **Make, Zapier, n8n, Google Sheets, Slack, Airtable:** connect it through Apify's integrations, or send each finished run to a **webhook**.
- **Datasets:** results stay in the run's dataset; export them or read them by API whenever you need them.

### Use it with AI agents (MCP)

Add Apify's MCP server with this Actor already pinned (`https://mcp.apify.com?tools=zaiq/image-comparator`) to Claude, ChatGPT, Cursor, VS Code or any MCP client. The agent can find this Actor and run it for you: ask it for "are these two product photos the same item, and how similar are they". AI agents can also pay for runs directly through Apify's agentic payments.

### Limits

- Similarity is visual, not textual: two different products in near-identical packaging can score high, and the same product on a busy background can score lower.
- Animated images are read from their first frame.
- Images over 20 MB or 60 megapixels are refused (free), as are links that return a web page instead of an image.
- Some image servers refuse downloads from cloud addresses; those rows show the server's answer and are free.
- Apify's free plan: the first 20 images.

### FAQ

**Do I need an AI key or an account?**

No. The model runs inside the Actor on Apify's servers; your images are not sent anywhere else.

**Which model is it?**

DINOv2-small from Meta (Apache-2.0), a vision model trained to tell images apart, plus a 64-bit perceptual hash and a colour histogram for each image.

**What does a similarity of 0.8 mean?**

Usually the same picture cropped, edited or watermarked. In our tests edited copies scored 0.89 to 0.99, other photos of the same landmark 0.44 to 0.91, and unrelated photos 0 to 0.30. Read the `verdict` column for a plain answer.

**Can it find duplicates without a source image?**

Yes. Leave Source images empty and every image is compared with the rest of the set; matching images share a `groupId`.

**Can I send base64?**

Yes: `data:image/png;base64,...` or bare base64 in the same list as links.

**What if an image cannot be downloaded?**

Its row says why (`status: failed`, `error`) and you pay nothing for it.

### Related Actors from Zaiq

- [video-frame-extractor](https://apify.com/zaiq/video-frame-extractor): frames from any video, to compare as images
- [google-shopping-scraper](https://apify.com/zaiq/google-shopping-scraper): product offers and prices, with their images
- [shopify-products-scraper](https://apify.com/zaiq/shopify-products-scraper): every product image of any Shopify store

### Support

Questions, a site that changed, or a field you need? Open an issue on this Actor's **Issues** tab: we answer there, usually within a day.

***

Also found as: image comparator, image similarity api, compare images, image similarity, duplicate image finder, perceptual hash, image deduplication, product image matching, visual similarity, reverse image matching.

# Actor input Schema

## `sourceImages` (type: `array`):

Links or base64 images to compare every target against. Leave empty to find duplicates inside the target set instead. Up to 100; the first 10 are free.

## `targetImages` (type: `array`):

Links (https://...) or base64 images (data:image/jpeg;base64,... or bare base64). Each one gets a row with its best match and score. Up to 10,000 when you give source images, 5,000 for duplicate finding.

## `threshold` (type: `number`):

A pair is a match when its similarity is at or above this. In our tests edited copies (resized, recompressed, cropped, rotated, watermarked) scored 0.89 to 0.99, other photos of the same object 0.44 to 0.91, unrelated photos under 0.31. 0.8 is a good start; 0.9 keeps near-identical copies only.

## `grayscale` (type: `boolean`):

Compare in greyscale, so the same picture in another colour still matches.

## `requestHeaders` (type: `object`):

Optional HTTP headers sent with every image download, for example a Referer some image servers ask for.

## Actor input object example

```json
{
  "sourceImages": [
    "https://picsum.photos/id/237/640/480"
  ],
  "targetImages": [
    "https://picsum.photos/id/237/320/240",
    "https://picsum.photos/id/1025/640/480",
    "https://picsum.photos/id/659/640/480"
  ],
  "threshold": 0.8,
  "grayscale": false
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset: the results.

## `summary` (type: `string`):

What each input returned, and notes.

# 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 = {
    "sourceImages": [
        "https://picsum.photos/id/237/640/480"
    ],
    "targetImages": [
        "https://picsum.photos/id/237/320/240",
        "https://picsum.photos/id/1025/640/480",
        "https://picsum.photos/id/659/640/480"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zaiq/image-comparator").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 = {
    "sourceImages": ["https://picsum.photos/id/237/640/480"],
    "targetImages": [
        "https://picsum.photos/id/237/320/240",
        "https://picsum.photos/id/1025/640/480",
        "https://picsum.photos/id/659/640/480",
    ],
}

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

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

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

```

## CLI example

```bash
echo '{
  "sourceImages": [
    "https://picsum.photos/id/237/640/480"
  ],
  "targetImages": [
    "https://picsum.photos/id/237/320/240",
    "https://picsum.photos/id/1025/640/480",
    "https://picsum.photos/id/659/640/480"
  ]
}' |
apify call zaiq/image-comparator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zaiq/image-comparator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

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