Skip to Content
New: ssim-native brings SSIM, MS-SSIM and Hitchhiker's to Node, and interpret-native ships diff interpretation on its own. Read more β†’
APIs@blazediff/cli

@blazediff/cli

CLI for image comparison. Wraps the native Rust binary (fastest), JS pixel diff, GMSD, SSIM, MS-SSIM, and Hitchhiker’s SSIM.

View Detailed BenchmarksΒ 

Installation

Global Installation

npm install -g @blazediff/cli

Local Installation

npm install --save-dev @blazediff/cli

Using npx

npx blazediff-cli image1.png image2.png diff.png

Available Commands

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.png

With Options

blazediff-cli image1.png image2.png diff.png --threshold 0.05 --antialiasing

Options

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 help

Exit Codes

  • 0 - Images are identical
  • 1 - Images have differences
  • 2 - 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!" fi

Why 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

AlgorithmBest for
core-native (default)Maximum speed, CI/CD, large images
coreCustom diff colors, color space control, no native deps
gmsdSimilarity score, compression-tolerant
ssimMATLAB-compatible, research
msssimMulti-scale, varying resolutions
hitchhikers-ssimFast SSIM (~4x), large batches
Last updated on