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

Metadata

Release files for blazediff 6.0.2

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.2
File Actions
blazediff-6.0.2-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details for blazediff-6.0.2-cp38-abi3-win_arm64.whl
blazediff-6.0.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for blazediff-6.0.2-cp38-abi3-win_amd64.whl
blazediff-6.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for blazediff-6.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
blazediff-6.0.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for blazediff-6.0.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
blazediff-6.0.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for blazediff-6.0.2-cp38-abi3-macosx_11_0_arm64.whl
blazediff-6.0.2-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for blazediff-6.0.2-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 3.6 MB

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

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

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

Download URL blazediff-6.0.2-cp38-abi3-win_amd64.whl
Size 567.9 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8389539ee7cda390b9aa1efc826d1fb17c6cb24fcfd6c8f8ae2b17992b496a9c
BLAKE2b-256 checksum
How to use checksums
d4d29c751fd1f1dec0ac7e141007c05b422ae95c946eb2325f4298558d6fad73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

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

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

Download URL blazediff-6.0.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 635.1 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
60b49f8de7267e375e3c1b61652fd3ca852432b0a6ecabc3ac314214c5752b33
BLAKE2b-256 checksum
How to use checksums
6348df1900c83bfb6cbf184a69bafd9c39681b297dda701de9f6ae478614678e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL blazediff-6.0.2-cp38-abi3-macosx_11_0_arm64.whl
Size 563.7 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
976dc2f6c298d0e7137ed97c1e0a3e5b11970951eed7df827e21b802701f4539
BLAKE2b-256 checksum
How to use checksums
c2db560bef81dcf1c4333375cd17a1ad77e60fd1cceab3e32360f9b4f485059e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL blazediff-6.0.2-cp38-abi3-macosx_10_12_x86_64.whl
Size 596.6 kB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5c9eba9898f954a11b6deec11437b6211ad0528e06bbcf58380ebca0fab91d30
BLAKE2b-256 checksum
How to use checksums
d24f26e2df6c6be34f1f767a5a8ee134a0262694b072fbe2b6a78adddc9381f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Security for blazediff 6.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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