screenshot-diff
Compare two PNG screenshots to detect visual differences in layout, spacing, color, and rendering. Returns a compact diff summary with normalized coordinates.
Instructions
Compare two PNG screenshots and return a compact visual-diff summary. Accepts saved baseline/current PNG paths, or one saved PNG plus one live full-resolution capture from a device. Always provide udid so the simulator-server dependency can be resolved. Use when stable before/after screenshots exist and the expected result is pixel-visible: layout, spacing, color, typography, image/icon rendering, clipping, overflow, or text rendering. For live captures, set exactly one of captureBaseline or captureCurrent; use baselinePath + captureCurrent for the common visual-regression flow. Returns { summary, diffPath, contextDiffPath }. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display. Ignores the fixed top status-bar band for both pixel and OCR text comparisons. Fails if the input sources are invalid, PNG files cannot be read, outputDir cannot be written, or the simulator-server / emulator backend is not reachable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Target device id from `list-devices` (iOS UDID or Android serial). | |
| rotation | No | Orientation override for live baseline/current captures. | |
| outputDir | No | Directory where diff artifacts should be written. Optional — defaults to a temp directory; the diff images are returned in the result either way. | |
| currentPath | No | Path to the current PNG file. Required unless captureCurrent is true. | |
| baselinePath | No | Path to the baseline PNG file. Required unless captureBaseline is true. | |
| captureCurrent | No | Capture the current screenshot live at full resolution before diffing. Cannot be combined with captureBaseline. | |
| captureBaseline | No | Capture the baseline screenshot live at full resolution before diffing. Cannot be combined with captureCurrent. |