Skip to Content
New: @blazediff/core-native now includes interpret — structured diff analysis to understand what changed. Read more →
Documentation@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) --interpret Run structured interpretation (region detection + classification) --output-format <fmt> Output format: png (default) or html (interpret report) -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.

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 html
Example
$ 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 rows

When to Use Each Algorithm

AlgorithmBest for
core-native (default)Maximum speed, CI/CD, large images, --interpret analysis
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