Skip to Content
Documentation@blazediff/bin

@blazediff/bin

Command-line tool for high-performance image comparison. Supports PNG, JPEG, and WebP formats with 60% better performance than alternatives. 60% faster than pixelmatch  with sharp-transformer .

View Detailed Benchmarks 

Installation

Global Installation

npm install -g blazediff

Local Installation

npm install --save-dev blazediff

Using npx

npx blazediff image1.png image2.png

Features

  • Multiple formats: PNG, JPEG, WebP support
  • 60% faster than pixelmatch CLI
  • Flexible output: Save diff images or get exit codes
  • CI/CD ready: Perfect for automated visual testing
  • Cross-platform: Works on Windows, macOS, and Linux

API Reference

Basic Comparison

blazediff image1.png image2.png

Save Diff Image

blazediff image1.png image2.png --output diff.png

Custom Threshold

blazediff image1.png image2.png --threshold 0.2

All Options

blazediff <image1> <image2> [options] Options: -o, --output <path> Output diff image path -t, --threshold <n> Matching threshold (0-1, default: 0.1) -a, --alpha <n> Opacity of original in diff (0-1, default: 0.1) --diff-color <r,g,b> Color for different pixels (default: 255,0,0) --aa-color <r,g,b> Color for anti-aliased pixels (default: 255,255,0) --include-aa Include anti-aliased pixels in diff count --diff-mask Output diff mask with transparent background --no-fast-check Disable fast buffer comparison -h, --help Display help -v, --version Display version

Exit Codes

The CLI uses exit codes for scripting:

  • 0 - Images are identical or within threshold
  • 1 - Images have differences beyond threshold
  • 2 - Error (file not found, invalid format, etc.)
blazediff img1.png img2.png if [ $? -eq 0 ]; then echo "Images match!" else echo "Images differ!" fi
Last updated on