CLI-Bild-Diff
Grundlegende Verwendung
Hier ist die Ausgabe, in der die gleichen und unterschiedlichen Bilder verglichen werden.
% abd image before.jpg before.jpg
similar ssim score=1.0000 threshold=0.9900
% abd image before.jpg after.jpg
different ssim score=0.9739 threshold=0.9900Dasselbe gilt für einen benutzerdefinierten Ähnlichkeitsschwellenwert und das JSON-Format.
% abd image before.jpg after.jpg --threshold 0.98 --format json
{"metric":"ssim","ok":false,"score":0.9739473116190345,"threshold":0.98,"error":0.02605268838096548}
Vollständige Befehlsdetails
% abd image -h
OVERVIEW: Compare two images and return an exit code for CI workflows.
USAGE: abd image [<options>] <left> <right>
ARGUMENTS:
<left> Left image path.
<right> Right image path.
OPTIONS:
--metric <value> Comparison mode. Allowed values: absolute, proportional, blurred, edge, ssim, deltae.
Default: ssim.
--threshold <value> Pass/fail limit (Double).
Practical range: 0.0..1.0 (not hard-enforced by CLI).
Defaults: ssim 0.99, deltae 0.02, absolute/proportional/blurred/edge 0.01.
For ssim: score must be >= threshold.
For all other metrics: error must be <= threshold.
--require-same-size Strict mode (default).
If sizes differ and `--normalize none`, exits with code 2.
--no-require-same-size Allow comparing different dimensions.
--normalize <value> How to align sizes before diffing.
Allowed values: none, left, right, fit-within.
- none: no resize; place both top-left on a shared canvas.
- left: keep left size; resize right to fit inside left bounds.
- right: keep right size; resize left to fit inside right bounds.
- fit-within: keep larger-area image; resize the smaller one to fit.
Default: none.
--blur-sigma <value> Blur strength used by `blurred` metric.
Practical range: > 0 (not hard-enforced by CLI). Default: 1.0.
--downsample <value> Downsample factor for `blurred` metric.
Effective range: integers >= 1 (CLI clamps with max(1, value)).
Recommended values: 1, 2, 4. Default: 2.
--edge-method <value> Edge detector for `edge` metric. Allowed values: canny, sobel.
Default: canny.
--canny-low <value> Low threshold for Canny (Double).
Typical range for 8-bit images: 0..255. Default: 50.0.
--canny-high <value> High threshold for Canny (Double).
Typical range for 8-bit images: 0..255. Usually set above `--canny-low`.
Default: 150.0.
--ssim-window <value> SSIM window size.
Effective range: odd integers >= 3 (CLI normalizes with max(3, value|1)).
Default: 11.
--ssim-sigma <value> SSIM Gaussian sigma.
Practical range: > 0 (not hard-enforced by CLI). Default: 1.5.
--delta-e <value> DeltaE variant. Allowed values: 76, 94, 2000.
Default: 76.
Note: 2000 is currently not supported by the implementation.
--write-diff <path> Save diff visualization image.
--write-heatmap <path> Save heatmap image.
--artifact-dir <path> Output directory for generated artifacts (auto names).
--format <value> Output format. Allowed values: text, json. Default: text.
--quiet No stdout output; rely on exit code only.
-h, --help Show help.
Exit-Codes
Exit-Codes sind Shell-Rückgabecodes des Befehls, nicht Text, der von
-h ausgegeben wird.
0: Bilder sind ähnlich (Schwelle erfüllt)1: Bilder sind unterschiedlich (Schwelle nicht erfüllt)2: Größenkonflikt im Strict-Size-Modus (--require-same-size+--normalize none)3: Die Bildeingabe konnte nicht geladen werden
Beispiele
# Compare different-sized images by fitting both into a shared canvas:
abd image before.jpg after.jpg --no-require-same-size --normalize fit-within
# Generate artifacts for review:
abd image before.jpg after.jpg --write-diff diff.png --write-heatmap heatmap.png
# Write all artifacts into one directory with automatic names:
abd image before.jpg after.jpg --artifact-dir ./out
# Use a different metric (edge):
abd image before.jpg after.jpg --metric edge --edge-method canny --threshold 0.03