visual_diff
Compare two web pages or HTML strings pixel-by-pixel, returning a diff image that highlights visual differences along with the changed pixel count and percentage.
Instructions
Compare two web pages (or HTML strings) pixel-by-pixel and return a diff image highlighting all visual differences. Supports full-page capture, device emulation, element selectors, and all screenshot-like options. Returns the diff image, changed pixel count, and percentage changed. Costs 1 API request.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clip | No | Crop region { x, y, width, height } in pixels | |
| click | No | CSS selector to click before capturing on both pages | |
| delay | No | Milliseconds to wait before capture on both pages (default: 0) | |
| url_a | No | URL of the first page (required if no html_a) | |
| url_b | No | URL of the second page (required if no html_b) | |
| width | No | Viewport width in pixels (default: 1280) | |
| height | No | Viewport height in pixels (default: 720) | |
| html_a | No | Raw HTML for the first page (required if no url_a) | |
| html_b | No | Raw HTML for the second page (required if no url_b) | |
| cookies | No | Cookies to set — array of "name=value" strings or { name, value, domain? } objects | |
| headers | No | Extra HTTP headers to send with the request | |
| blockAds | No | Block advertisements on the page | |
| darkMode | No | Emulate dark color scheme (default: false) | |
| fullPage | No | Capture the full scrollable page for both sides (default: false) | |
| injectJs | No | Custom JavaScript to execute before capturing (max 50KB) | |
| selector | No | CSS selector — capture only this element on both pages | |
| timeZone | No | Override browser timezone (e.g. "America/New_York") | |
| bypassCSP | No | Bypass Content-Security-Policy on the page | |
| injectCss | No | Custom CSS to inject before capturing (max 50KB) | |
| mediaType | No | Emulate CSS media type | |
| threshold | No | Pixelmatch sensitivity 0–1 (default: 0.1). Lower = more sensitive to subtle differences. | |
| userAgent | No | Override the browser User-Agent string | |
| waitUntil | No | When to consider navigation finished (default: networkidle2) | |
| blockChats | No | Block live chat widgets on the page | |
| geolocation | No | Emulate geolocation { latitude, longitude, accuracy? } | |
| blockBanners | No | Hide cookie consent banners (default: false) | |
| authorization | No | Authorization header value (e.g. "Bearer <token>") | |
| blockRequests | No | URL patterns to block (array of strings) | |
| blockTrackers | No | Block tracking scripts on the page | |
| hideSelectors | No | Array of CSS selectors to hide before capture | |
| reducedMotion | No | Emulate prefers-reduced-motion to disable animations | |
| blockResources | No | Resource types to block (e.g. ["image", "font"]) | |
| fullPageScroll | No | Auto-scroll pages before capture to trigger lazy-loaded images | |
| viewportDevice | No | Device preset for viewport emulation (e.g. "iphone_14_pro"). Use list_devices to see all presets. | |
| viewportMobile | No | Enable mobile meta viewport emulation | |
| waitForSelector | No | Wait for this CSS selector to appear before capturing | |
| fullPageScrollBy | No | Pixels to scroll per step (default: viewport height) | |
| viewportHasTouch | No | Enable touch event emulation | |
| deviceScaleFactor | No | Device pixel ratio (default: 1) | |
| fullPageMaxHeight | No | Maximum pixel height cap for full-page captures | |
| navigationTimeout | No | Navigation timeout in ms (default: 25000) | |
| viewportLandscape | No | Landscape orientation | |
| fullPageScrollDelay | No | Delay between scroll steps in ms (default: 400) |