@blazediff/cli
CLI for image comparison. Wraps the native Rust binary (fastest), JS pixel diff, GMSD, SSIM, MS-SSIM, and Hitchhiker’s SSIM.
Installation
Global Installation
npm install -g @blazediff/cliLocal Installation
npm install --save-dev @blazediff/cliUsing npx
npx blazediff-cli image1.png image2.png diff.pngAvailable Commands
core-native (default)
blazediff-cli core-native (default)
Native Rust binary with SIMD optimization. The fastest option - 3-4x faster than odiff on large images.
Basic Usage
# Default command (core-native)
blazediff-cli image1.png image2.png diff.png
# Or explicitly
blazediff-cli core-native image1.png image2.png diff.pngWith Options
blazediff-cli image1.png image2.png diff.png --threshold 0.05 --antialiasingOptions
blazediff-cli core-native <image1> <image2> [output] [options]
Options:
-t, --threshold <n> Color difference threshold (0-1, default: 0.1)
-a, --antialiasing Enable anti-aliasing detection
--diff-mask Output only differences (transparent background)
-c, --compression <n> PNG compression level (0-9, default: 0)
--interpret Run structured interpretation (region detection + classification)
--output-format <fmt> Output format: png (default) or html (interpret report)
-h, --help Display helpExit Codes
0- Images are identical1- Images have differences2- Error (file not found, invalid format, etc.)
blazediff-cli image1.png image2.png diff.png
if [ $? -eq 0 ]; then
echo "Images match!"
else
echo "Images differ!"
fiWhy so fast? Uses a two-pass block-based algorithm with SIMD acceleration (NEON on ARM, SSE4.1 on x86). The cold pass quickly identifies unchanged blocks, then the hot pass only processes changed regions.
Interpret Mode
Add --interpret to get structured diff analysis — region detection, content-aware classification (Addition, Deletion, Shift, ContentChange, ColorChange, RenderingNoise), severity scoring, and human-readable summaries.
# JSON output to stdout
blazediff-cli image1.png image2.png --interpret
# With diff image + interpretation
blazediff-cli image1.png image2.png diff.png --interpret
# HTML report
blazediff-cli image1.png image2.png report.html --output-format htmlExample
$ blazediff-cli image1.png image2.png --interpret
{
"summary": "Moderate visual change detected (1.87% of image, 10 regions).\n...",
"severity": "Medium",
"diffPercentage": 1.87,
"regions": [...]
}
$ blazediff-cli image1.png image2.png report.html --output-format html
# writes report.html with side-by-side images and clickable region rowsWhen to Use Each Algorithm
| Algorithm | Best for |
|---|---|
core-native (default) | Maximum speed, CI/CD, large images, --interpret analysis |
core | Custom diff colors, color space control, no native deps |
gmsd | Similarity score, compression-tolerant |
ssim | MATLAB-compatible, research |
msssim | Multi-scale, varying resolutions |
hitchhikers-ssim | Fast SSIM (~4x), large batches |
Links
Last updated on