Skip to main content

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

Project description

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
  • 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);

Interpret

Structured region analysis that takes a raw pixel diff and produces human-readable change descriptions. Available via --interpret in the CLI or interpret() in the library.

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blazediff-5.1.0-cp38-abi3-win_arm64.whl (582.7 kB view details)

Uploaded CPython 3.8+Windows ARM64

blazediff-5.1.0-cp38-abi3-win_amd64.whl (596.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

blazediff-5.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (739.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

blazediff-5.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (692.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

blazediff-5.1.0-cp38-abi3-macosx_11_0_arm64.whl (620.3 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

blazediff-5.1.0-cp38-abi3-macosx_10_12_x86_64.whl (650.1 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file blazediff-5.1.0-cp38-abi3-win_arm64.whl.

File metadata

  • Download URL: blazediff-5.1.0-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 582.7 kB
  • Tags: CPython 3.8+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for blazediff-5.1.0-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 cb6c4967285dcb1e74e0e5ec7fd3f95d9cbdae93cb5bfd1ac08694f007472ea1
MD5 a8ad99437cde69475f9843c214300d9b
BLAKE2b-256 51165e461cf028e3a63ef525542bab9cb647e4f680aaeb35dea56977dcfe8274

See more details on using hashes here.

File details

Details for the file blazediff-5.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: blazediff-5.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 596.2 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for blazediff-5.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f68c0a9db53223e15fbf3bf3f8abc32e5310b3d30ecada496952b27505f807a3
MD5 a882786e57efe95960eaccbb7325b494
BLAKE2b-256 96ad3b7b0b62af06c10cd0b8de3c29f7067948e7a23861f806e75b4afacd323b

See more details on using hashes here.

File details

Details for the file blazediff-5.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blazediff-5.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ee4ab0bc239f85cd6425142e332d693803fd3b1ea6185f3185b26f5aaf9229a2
MD5 4ff2e76d1d103a62f40f19e26f77615b
BLAKE2b-256 5ccb3191f76391f57806ec7232953721d96c7d9c189e45cbcebba685b76e86ce

See more details on using hashes here.

File details

Details for the file blazediff-5.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for blazediff-5.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 77cc7364e44845bca7e56fa7803fb0ade2cecc295817869c416b724c560c5f7b
MD5 093f3ed3c3e6eac91a5defb0c7cdf031
BLAKE2b-256 bee940f487a994a490ea0c9269f91275968eec37d41029b0ca233569002edc19

See more details on using hashes here.

File details

Details for the file blazediff-5.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blazediff-5.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb349b1df1d4fff53033c76997e217686fa397d745b943f3a67e79ad5c562c55
MD5 deb13b3cf9779914652ea4aafb6bbeec
BLAKE2b-256 3cb6a1de8207b05cbb25569c524f83b63a8e1f1521bc3e79995e238576d03652

See more details on using hashes here.

File details

Details for the file blazediff-5.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for blazediff-5.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e197d7a5ec5f30fd211e0f5415b4017b289262c6f7472fa159a145c48d917757
MD5 e8ba1753b7ed3332a908467b0e175d96
BLAKE2b-256 fe73c620691faa8a9924f878aa3405cf544635cb15ab232bc0551eb08979b44e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page