compare_design
Compare a design screenshot with an implementation screenshot. Returns pixel difference metrics, structural similarity score, and optional diff image with highlighted differences.
Instructions
Compare a design screenshot with an implementation screenshot using pixelmatch and SSIM. Supports PNG, JPEG, WebP, GIF, TIFF, and SVG inputs (SVGs are rasterized at svg_density). Returns the number and percentage of different pixels, a structural-similarity (SSIM) score, a diff bounding box and heat grid showing where differences cluster, and optionally outputs a diff image highlighting the differences.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| localize | No | If true (default), include a diff bounding box and a coarse per-cell heat grid in the result, showing where differences cluster. Set false to skip the extra pass. | |
| threshold | No | Matching threshold (0-1). Smaller values make the comparison more sensitive. Default is 0.1. | |
| resize_fit | No | How to scale the implementation when dimensions differ. 'contain' (default) preserves aspect ratio and letterboxes; 'fill' stretches to the exact dimensions; 'cover' preserves aspect ratio and crops the overflow. | contain |
| auto_resize | No | If true (default), the implementation screenshot is scaled to the design's dimensions when they differ, instead of failing. Set false to require identical dimensions. | |
| design_path | Yes | Path to the design screenshot (supports PNG, JPEG, WebP, GIF, TIFF, SVG) | |
| svg_density | No | Rasterization density (DPI) for SVG inputs. Higher = crisper vector render before comparison. Default 288 (4x the 72dpi baseline). Aimed at small assets (icons/logos); lower it for large vector art. | |
| ignore_regions | No | Rectangles (design-space coordinates) to exclude from the comparison, e.g. dynamic content like timestamps or avatars. Excluded pixels count toward neither the diff nor the percentage denominator. | |
| output_diff_path | No | Optional path to save the diff image. If not provided, the diff image will be returned as base64. | |
| implementation_path | Yes | Path to the implementation screenshot (supports PNG, JPEG, WebP, GIF, TIFF, SVG) | |
| max_difference_percentage | No | If set and the difference percentage exceeds it, the call returns an error (isError: true). Use as a CI gate against a golden image. Omit for report-only. |