Skip to main content

blazediff

High-performance image diffing with block-based optimization and SIMD acceleration.

Crates.io npm PyPI License: MIT

Features

  • Block-based optimization - Skip identical regions for massive speedups on similar images
  • SIMD acceleration - Native SSE4.1 (x86) and NEON (ARM) implementations
  • Multiple formats - PNG, JPEG, and QOI support, via blazediff-shared
  • Perceptual diffing - YIQ-based color difference with antialiasing detection
  • In-house PNG codec - optional blazediff_png, faster than spng on every fixture, with byte-exact decode parity; opt-in via BLAZEDIFF_PNG_ENABLED
  • Cross-platform - Linux, macOS, and Windows support
  • Multi-language - Native Rust crate, Node.js (N-API), and Python (PyO3) bindings - all sharing the same core

Installation

Rust (CLI + library)

cargo install blazediff

Node.js - @blazediff/core-native

npm install @blazediff/core-native

N-API bindings shipped as pre-built .node binaries for macOS, Linux, and Windows (arm64 + x64). Built from this crate's napi Cargo feature.

import { compare } from "@blazediff/core-native";

const result = await compare("expected.png", "actual.png", "diff.png", {
  threshold: 0.1,
});

Python - blazediff

pip install blazediff

PyO3 bindings shipped as abi3-py38 wheels for CPython ≥ 3.8 (macOS, Linux manylinux, Windows; arm64 + x86_64). Built from this crate's python Cargo feature.

from blazediff import compare

result = compare("expected.png", "actual.png", "diff.png", threshold=0.1)
if result.match:
    print("identical")
else:
    print(f"{result.diff_count} pixels differ ({result.diff_percentage:.2f}%)")

CLI Usage

# Basic diff
blazediff image1.png image2.png -o diff.png

# With custom threshold (0.0 - 1.0)
blazediff image1.png image2.png -o diff.png -t 0.1

# JSON output for scripting
blazediff image1.png image2.png --json

Library Usage

use blazediff::{diff, DiffOptions};

let options = DiffOptions {
    threshold: 0.1,
    include_anti_aliased: false,
    ..Default::default()
};

let result = diff("image1.png", "image2.png", Some("diff.png"), &options)?;
println!("Different pixels: {}", result.diff_count);

Structural similarity

This crate is a pixel diff: it answers where two images differ. For how alike they look — SSIM, MS-SSIM, Hitchhiker's SSIM — use blazediff-ssim, which stands alone and shares nothing with this crate but the blazediff-shared primitives. It is also what @blazediff/ssim-native wraps.

Interpret

Structured region analysis that produces human-readable change descriptions. It is not part of this crate: it lives in blazediff-interpret, which consumes what diff returns, with its own blazediff-interpret CLI.

The classifier is independent of whatever found the regions. Anything that can say where something changed can drive it: blazediff-ssim by thresholding a score map, or a caller passing boxes directly. Coarse boxes are fine — each is refined against the source pixels before any statistic is computed, so the analysis stays per-pixel.

See INTERPRET.md for the full algorithm documentation - pipeline stages, formulas, classification rules, and output format.

Performance

3-4x faster than odiff, 8x faster than pixelmatch on 4K images.

Image I/O lives in blazediff-shared, shared with the other crates; load_png, save_jpeg and friends are re-exported here unchanged. PNG I/O defaults to spng. Setting BLAZEDIFF_PNG_ENABLED=1 routes decode and stored (level 0) encode through the in-house blazediff_png codec, which is faster than spng on every fixture.

License

MIT

Release files for blazediff 6.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for blazediff 6.0.0
File
blazediff-6.0.0-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details
blazediff-6.0.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
blazediff-6.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
blazediff-6.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
blazediff-6.0.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
blazediff-6.0.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.6 MB

Release files / blazediff-6.0.0-cp38-abi3-win_arm64.whl

Download URL blazediff-6.0.0-cp38-abi3-win_arm64.whl
Size 542.2 kB
Tags CPython 3.8 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
31a7aaddaedafced8c798f49d43ab359fa1024f3ab0e1e1277bc3c8b2aeba187
BLAKE2b-256 checksum
How to use checksums
030d0296c219992059ade10267251cfacefe4cc01393ffbd5b1a9603c6e1a9a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / blazediff-6.0.0-cp38-abi3-win_amd64.whl

Download URL blazediff-6.0.0-cp38-abi3-win_amd64.whl
Size 564.9 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ea22dd22731e9007b3cf33f4f9ecb1680819fbaaeb33c0c0ffced31daf03a95f
BLAKE2b-256 checksum
How to use checksums
fbc99bfc4018add185e715996b99d0ad8bb4ea65d5cb9753ea2432967007131c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / blazediff-6.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL blazediff-6.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 674.8 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fbf5c186d7d53b783a5ef1107ce00da176fbd54184491ccc9b5b792055b7740b
BLAKE2b-256 checksum
How to use checksums
b71dab7231988d41749891d9cf9d2686f11ed39c9cf8cc45ca047129a14b3970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / blazediff-6.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL blazediff-6.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 636.4 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
3671f61c3fd7731812ceabb5659ca2920d74e66d3dd3c7b82962612388b937f5
BLAKE2b-256 checksum
How to use checksums
46ce8710efe2915a0a1c4c3af11c4a896018a53efdea29515d89349b4263fada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / blazediff-6.0.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL blazediff-6.0.0-cp38-abi3-macosx_11_0_arm64.whl
Size 564.8 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
24c25a76ad8498a722f42ac6dd910965a7dcc73b07568442f19c0d74a76c23d4
BLAKE2b-256 checksum
How to use checksums
e7264e773beb19d691b97f6ce0f5654a47006843fbe64717a25694f8ab1c1a54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / blazediff-6.0.0-cp38-abi3-macosx_10_12_x86_64.whl

Download URL blazediff-6.0.0-cp38-abi3-macosx_10_12_x86_64.whl
Size 595.7 kB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
46e92fd3fa1b68cff595031d22c22e1da56be4fea26af44a7bacffe089ec87bf
BLAKE2b-256 checksum
How to use checksums
947a7e350c523ebb88e7aec872742230d3bab4a0e0dc4be5a2cba15d90018495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release history Release notifications | RSS feed

6.0.1

6 release files

This release

6.0.0 This release

6 release files

5.4.0

6 release files

5.3.0

6 release files

5.2.0

6 release files

5.1.0

6 release files

5.0.0

6 release files

4.3.4

6 release files

4.3.3

6 release files

4.3.2

6 release files

4.2.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page