diff
Compare two screenshots and output difference metrics.
No Bridge Required
This command operates on local image files — no bridge or running Tauri app needed.
Usage
Options
| Option | Description | Default |
|---|---|---|
<image1> |
First image path | (required) |
<image2> |
Second image path | (required) |
-o, --output <path> |
Write a visual diff image to this path | — |
--threshold <percent> |
Fail (exit code 1) if difference exceeds this percentage | — |
--json |
Output structured JSON | — |
Examples
Basic comparison
Generate a diff image
Threshold gating (CI use)
# Fail if more than 1% of pixels differ
tauri-agent-tools diff /tmp/expected.png /tmp/actual.png --threshold 1
echo $? # 0 = pass, 1 = threshold exceeded
JSON output
Requirements
Requires ImageMagick installed on the system. Both v6 (compare, identify) and v7 (magick compare, magick identify) are supported automatically. Both images must have matching dimensions, and identify must be able to read them for every comparison. Thresholds must be finite numbers from 0 to 100. ImageMagick exit code 1 means the images differ; tool failures, malformed images, and unwritable output paths are reported as errors instead of pixel counts. A threshold failure keeps its result on stdout and exits 1.