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_result:
    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.1

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.1
File
blazediff-6.0.1-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details
blazediff-6.0.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
blazediff-6.0.1-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.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
blazediff-6.0.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
blazediff-6.0.1-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.1-cp38-abi3-win_arm64.whl

Download URL blazediff-6.0.1-cp38-abi3-win_arm64.whl
Size 545.0 kB
Tags CPython 3.8 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
67676391072da90a05e17876b9883414ec623411515b9ac6169b38e76f6ec63a
BLAKE2b-256 checksum
How to use checksums
3c90b8dce9dd902354ea2fa674149a1711b3fac2668962e88c949e18d1b0e7f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL blazediff-6.0.1-cp38-abi3-win_amd64.whl
Size 565.7 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
83ed37f8b02b1eb0cb91e92f2af1149f681788cb6cc58f9910e971b5cf19dce9
BLAKE2b-256 checksum
How to use checksums
7166a7fd70797ea753bcc4cb8202a9372bc2026ddcccb27018749cf047a0bc9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

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

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

Download URL blazediff-6.0.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 637.1 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
4f0a783f0cafaae7fafaf25484a23cfa28688f058ccc29e734025655e798d750
BLAKE2b-256 checksum
How to use checksums
3e61f1958689890d22f0ac3330aaec962cdbb192b8c97a7c9fce4354bd66522a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL blazediff-6.0.1-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
1dfeac7cec74360f19f49453f4afbf385fa9dd015daf8140bbfec99e2252767c
BLAKE2b-256 checksum
How to use checksums
2040f06c6aec48f144197e54d1635242a31e0f64bbfa2002ec63bfe6bfde285d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL blazediff-6.0.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 595.4 kB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6cbae72fa5b51b95a9f0bd83341ebef1e02fc362794e24c52592999b8decbf81
BLAKE2b-256 checksum
How to use checksums
24db82242529074a484bd0d8dec75df05bf4d4609848f83be8592184449fd3f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

This release

6.0.1 This release

6 release files

6.0.0

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