@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)
-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.
When to Use Each Algorithm
| Algorithm | Best for |
|---|---|
core-native (default) | Maximum speed, CI/CD, large images |
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