# Web Screenshot, Visual Diff & AI Annotator API (`alias_md5/web-screenshot-visual-api`) Actor

Capture crisp full-page or element screenshots, catch competitor pricing and UI changes automatically with highlighted visual diffs, label clickable controls for AI vision agents, or export pages to PDF. Pay only for delivered captures ($0 on broken URLs).

- **URL**: https://apify.com/alias_md5/web-screenshot-visual-api.md
- **Developed by:** [Alias Data Studio](https://apify.com/alias_md5) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.80 / 1,000 web screenshot captureds

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

## Web Screenshot, Visual Diff & AI Annotator API

Capture **pixel-exact lossless web screenshots**, generate **AI Set-of-Mark annotated screenshots with structured interactive element coordinates**, run **pixel-level visual regression diffs**, and export **print-grade vector PDFs or MHTML archives** in one unified API.

Built for modern web QA teams, multimodal AI vision agents, compliance archiving, and automated monitoring — priced transparently from **$1.30 to $5.00 per 1,000 captures** with **zero charges on broken, 404, or timed-out URLs**.

### Four Production Visual Workflows in One Actor

#### 1. Pixel-Exact Web Screenshots (`mode: "screenshot"`)

- **Lossless PNG verification** — every PNG capture is verified round-trip with `maxChannelDelta = 0`, preserving exact RGB/RGBA channels and dimensions.
- **Flexible formats & resolutions** — choose `png`, `jpeg`, or `webp` (quality `1–100`), Desktop (`1440x900`), Mobile (`390x844`), Tablet (`768x1024`), or custom viewports with `1x` or `2x` Retina density.
- **Full-page & CSS element cropping** — capture full scrollable pages or crop a single CSS selector cleanly.
- **Clean capture hygiene** — optional automatic hiding of common cookie consent banners, dark color scheme emulation, and configurable readiness waits (`load`, `domContentLoaded`, `networkIdle`, `waitForSelector`, `delayMs`).

#### 2. AI Vision Agent Set-of-Mark Annotation (`mode: "ai_annotate"`)

- **Ready for multimodal LLMs & Vision Agents** — automatically detects visible interactive controls (links, buttons, inputs, dropdowns, textareas) inside the active viewport.
- **Non-destructive off-DOM numbered badges (`E1`, `E2`, ...)** — draws crisp, color-coded bounding boxes and readable bitmap labels directly onto the lossless PNG without altering page layout or mutating pixels outside drawn overlays.
- **Structured coordinate manifest** — returns every labeled element's `id`, `tag`, `role`, `label`, `href`, CSS `selector`, `xpath`, `cssBounds`, `pixelBounds`, and center coordinates alongside the annotated PNG URL.

#### 3. Pixel-Exact Visual Regression Diff (`mode: "visual_diff"`)

- **Live-to-live or image-to-live comparisons** — compare `(baselineUrl, targetUrl)` side-by-side or validate a live page against a saved lossless PNG (`baselineImageUrl`).
- **Exact pixel metrics** — reports `dimensionsMatch`, `isPixelExact`, `maxChannelDelta`, `mismatchPixelCount`, `totalPixelCount`, `mismatchPercentage`, `passed`, and clustered `changedRegions` bounding boxes.
- **Instant visual diff artifact (`diff.png`)** — highlights differing pixels in vivid crimson/magenta over a dimmed grayscale layout context, and flags dimension overflow regions clearly.

#### 4. Vector PDF & Single-File MHTML Archiving (`mode: "pdf_export"`)

- **Print-grade vector PDFs** — supports `A4`, `Letter`, `Legal`, and `Tabloid` paper sizes, portrait or landscape orientation, CSS background graphics, custom margins, scaling, and page ranges.
- **Single-file MHTML snapshots** — archive complete rendered web pages with embedded resources for compliance and legal record-keeping.
- **Structured metadata & text summary** — attaches page title, HTTP status, PDF page count, SHA-256 checksum, normalized text excerpt, and word count.

### Pricing

Pay only for successfully delivered captures saved to Key-Value Storage and your dataset. Broken links (4xx/5xx), unreachable domains, invalid images, and timeouts are skipped safely at **$0**.

| Apify Plan | Screenshot (`screenshot-capture`) | AI Annotator (`ai-annotated-capture`) | Visual Diff (`visual-diff-check`) | PDF / MHTML (`pdf-export`) |
| --- | ---: | ---: | ---: | ---: |
| Free | $3.00 / 1k | $4.00 / 1k | $5.00 / 1k | $4.00 / 1k |
| Bronze | $2.60 / 1k | $3.50 / 1k | $4.40 / 1k | $3.50 / 1k |
| Silver | $2.20 / 1k | $3.00 / 1k | $3.80 / 1k | $3.00 / 1k |
| Gold | $1.80 / 1k | $2.50 / 1k | $3.20 / 1k | $2.50 / 1k |
| Platinum | $1.50 / 1k | $2.00 / 1k | $2.60 / 1k | $2.00 / 1k |
| Diamond | $1.30 / 1k | $1.80 / 1k | $2.20 / 1k | $1.80 / 1k |

### Quick-Start Input Examples

#### Lossless Batch Screenshot

```json
{
  "mode": "screenshot",
  "urls": ["https://example.com"],
  "viewportPreset": "desktop",
  "deviceScaleFactor": 2,
  "fullPage": true,
  "format": "png",
  "hideCookieBanners": true
}
```

#### AI Set-of-Mark Annotation

```json
{
  "mode": "ai_annotate",
  "urls": ["https://example.com"],
  "viewportPreset": "desktop",
  "maxElements": 60,
  "labelPrefix": "E",
  "includeCleanScreenshot": true
}
```

#### Pixel-Exact Visual Regression Diff

```json
{
  "mode": "visual_diff",
  "baselineUrl": "https://example.com",
  "targetUrl": "https://example.com",
  "viewportPreset": "desktop",
  "channelThreshold": 0,
  "failThresholdPercent": 0,
  "includeSourceSnapshots": true
}
```

#### Print-Grade Vector PDF Archive

```json
{
  "mode": "pdf_export",
  "urls": ["https://example.com"],
  "exportFormat": "pdf",
  "paperFormat": "A4",
  "printBackground": true,
  "includeTextSummary": true
}
```

### Output Structure

Every delivered file (`shot_001.png`, `annotated_001_annotated.png`, `diff_001_diff.png`, `doc_001.pdf`) is saved to your run's **Key-Value Store**, and a structured JSON record is pushed to the **Dataset** with direct download links and verification metrics:

```json
{
  "mode": "ai_annotate",
  "sourceUrl": "https://example.com",
  "finalUrl": "https://example.com/",
  "pageTitle": "Example Domain",
  "httpStatus": 200,
  "artifactKey": "annotated_001_annotated.png",
  "artifactUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/annotated_001_annotated.png",
  "contentType": "image/png",
  "bytesSize": 31842,
  "sha256": "...",
  "widthPixels": 1440,
  "heightPixels": 900,
  "lossless": {
    "verified": true,
    "maxChannelDelta": 0,
    "hasIccpProfile": false,
    "colorType": "Rgba",
    "bitDepth": 8
  },
  "elementCount": 1,
  "elements": [
    {
      "id": "E1",
      "index": 1,
      "tag": "a",
      "role": "link",
      "label": "More information...",
      "href": "https://www.iana.org/domains/example",
      "cssBounds": { "x": 160, "y": 244, "width": 141, "height": 19 },
      "pixelBounds": { "x": 160, "y": 244, "width": 141, "height": 19 }
    }
  ]
}
```

A compact `RUN_SUMMARY` JSON object is also stored in Key-Value Storage after every run with delivery counts, byte totals, billed event counts, and redacted failure diagnostics.

### Ideal Use Cases

- **Multimodal AI & Vision Agents** — ground LLM actions directly on Set-of-Mark numbered screenshots and verified element bounding boxes.
- **CI/CD Visual Regression Testing** — catch unintended CSS, typography, or layout regressions down to a single pixel channel delta.
- **Competitive & Brand Monitoring** — archive desktop and mobile landing pages, pricing tables, and seasonal campaigns on schedule.
- **Compliance & Legal Archiving** — capture timestamped SHA-256 verified vector PDFs and self-contained MHTML web records.

# Actor input Schema

## `mode` (type: `string`):

Select the visual processing workflow: lossless screenshots, AI Set-of-Mark element annotation, pixel-exact visual regression diff, or vector PDF/MHTML document export.

## `urls` (type: `array`):

One or more public HTTP(S) web page URLs to capture, annotate, or export. Duplicates are removed automatically. Broken or 404 URLs are skipped at $0.

## `diffPairs` (type: `array`):

For visual_diff mode: list of comparison pairs with targetUrl plus either baselineUrl (live web page) or baselineImageUrl (reference lossless PNG URL).

## `baselineUrl` (type: `string`):

Optional single baseline web page URL to compare against targetUrl in visual_diff mode.

## `baselineImageUrl` (type: `string`):

Optional direct URL to an existing lossless PNG baseline image to compare against targetUrl in visual_diff mode.

## `targetUrl` (type: `string`):

Target web page URL to compare against baselineUrl or baselineImageUrl in visual_diff mode.

## `channelThreshold` (type: `integer`):

Per-channel RGBA delta threshold (0 = strict bit-exact pixel comparison).

## `failThresholdPercent` (type: `number`):

Maximum mismatch percentage allowed for diff.passed to be true (0 = zero differing pixels allowed).

## `includeSourceSnapshots` (type: `boolean`):

When enabled, saves baseline and target PNGs alongside the highlighted diff PNG in Key-Value Storage.

## `viewportPreset` (type: `string`):

Standard device viewport preset or custom dimensions.

## `viewportWidth` (type: `integer`):

Optional custom CSS viewport width in pixels (200–3840).

## `viewportHeight` (type: `integer`):

Optional custom CSS viewport height in pixels (200–4320).

## `deviceScaleFactor` (type: `integer`):

Pixel density multiplier: 1 for standard resolution or 2 for crisp Retina captures.

## `fullPage` (type: `boolean`):

Capture the full scrollable height of the web page instead of only the visible viewport.

## `selector` (type: `string`):

Optional CSS selector to capture and crop a specific element on the page.

## `format` (type: `string`):

Output image encoding for screenshot mode. PNG preserves bit-exact lossless fidelity (maxChannelDelta = 0).

## `quality` (type: `integer`):

Compression quality applied when format is jpeg or webp.

## `hideCookieBanners` (type: `boolean`):

Automatically hide common cookie consent banners and privacy popups before capture.

## `darkMode` (type: `boolean`):

Request prefers-color-scheme: dark while rendering pages.

## `waitUntil` (type: `string`):

Lifecycle event to wait for before capturing the page.

## `waitForSelector` (type: `string`):

Optional CSS selector that must become visible before capture starts.

## `delayMs` (type: `integer`):

Optional additional pause in milliseconds (0–15000) after page load before capture.

## `timeoutSeconds` (type: `integer`):

Maximum time in seconds to wait for each target URL (5–120).

## `maxElements` (type: `integer`):

Maximum number of visible interactive elements to label in ai_annotate mode (1–250).

## `labelPrefix` (type: `string`):

Short prefix printed on element badges (for example E produces E1, E2, E3).

## `borderWidth` (type: `integer`):

Stroke width in pixels for drawn annotation boxes (1–6).

## `includeCleanScreenshot` (type: `boolean`):

When enabled in ai_annotate mode, stores the original unannotated PNG alongside the annotated PNG.

## `exportFormat` (type: `string`):

Select vector PDF or single-file MHTML archive for pdf_export mode.

## `paperFormat` (type: `string`):

Standard paper format used for PDF export.

## `landscape` (type: `boolean`):

Print PDF pages in landscape orientation.

## `printBackground` (type: `boolean`):

Include CSS background colors and images in exported PDFs.

## `marginInches` (type: `number`):

Uniform top/bottom/left/right page margin in inches (0–3).

## `pageRanges` (type: `string`):

Optional page ranges to export (for example 1-3, 5). Leave empty for all pages.

## `includeTextSummary` (type: `boolean`):

Attach normalized page text excerpt and word count alongside exported PDF/MHTML records.

## Actor input object example

```json
{
  "mode": "screenshot",
  "urls": [
    "https://example.com"
  ],
  "channelThreshold": 0,
  "failThresholdPercent": 0,
  "includeSourceSnapshots": true,
  "viewportPreset": "desktop",
  "deviceScaleFactor": 1,
  "fullPage": false,
  "format": "png",
  "quality": 90,
  "hideCookieBanners": true,
  "darkMode": false,
  "waitUntil": "load",
  "delayMs": 0,
  "timeoutSeconds": 30,
  "maxElements": 60,
  "labelPrefix": "E",
  "borderWidth": 2,
  "includeCleanScreenshot": false,
  "exportFormat": "pdf",
  "paperFormat": "A4",
  "landscape": false,
  "printBackground": true,
  "marginInches": 0.4,
  "includeTextSummary": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

# 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 = {
    "mode": "screenshot",
    "urls": [
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alias_md5/web-screenshot-visual-api").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 = {
    "mode": "screenshot",
    "urls": ["https://example.com"],
}

# Run the Actor and wait for it to finish
run = client.actor("alias_md5/web-screenshot-visual-api").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 '{
  "mode": "screenshot",
  "urls": [
    "https://example.com"
  ]
}' |
apify call alias_md5/web-screenshot-visual-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alias_md5/web-screenshot-visual-api"
        }
    }
}
```

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/D2yAkNPoRwgJ7g2z9/builds/6hZrkqOpPaXv6ed49/openapi.json
