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
  • 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.

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-4.3.4-cp38-abi3-win_arm64.whl (492.8 kB view details)

Uploaded CPython 3.8+Windows ARM64

blazediff-4.3.4-cp38-abi3-win_amd64.whl (494.0 kB view details)

Uploaded CPython 3.8+Windows x86-64

blazediff-4.3.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (639.4 kB view details)

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

blazediff-4.3.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (609.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

blazediff-4.3.4-cp38-abi3-macosx_11_0_arm64.whl (556.1 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

blazediff-4.3.4-cp38-abi3-macosx_10_12_x86_64.whl (570.9 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for blazediff-4.3.4-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 08eefd49d0b76f05ec1b99ff655f93a8de27645233525392a76987e1ba8a8ede
MD5 77523b58330fd351630e1c014f7546ce
BLAKE2b-256 f6c7ae3444c21820659d0890e6d1b1cb0f6ed10cd6ce5e6e9758dde1e7c77641

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for blazediff-4.3.4-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ffcf6b32305559ab0d65a8f0cdde7a3ece4d174c9d253ba721fda635345146a8
MD5 93874818feefa1711db42d0f674f116b
BLAKE2b-256 d7fa3e3e7d718a24ad7e6c14275f57af87816c44b110e70f2c03cb0d88116982

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 276494633afd795f17fd12115b25a7f3fa3387d7d51f104050238ec7364961d0
MD5 5b79c5a05c008a4adefef88c69bcec99
BLAKE2b-256 8f26f74d867e7908f6c4a3eff25a6db791b10491e52add10b2558bda0e34ed32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 de4f90df4dcce9d9d6b7686692f53fcf3a6a3301b7ed5a27b82b5a4a7edfa5e5
MD5 9b6f59f3b17de0d80bd4d87240193cbd
BLAKE2b-256 d27c1afa93af824266bed865a0b0dac9ee1027bde952a45736b1d9ae3dec9ec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.4-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12afc5ff1692f5eddd5bc5fbe40c0d395312a85025c98ccd8f3c73cff729a8ec
MD5 95ac8da4bda921f058d2370fb5d0595e
BLAKE2b-256 11a49d4607d5615c3eb5a5d134750741a59a246fec4b5ccc0bfd43451b5f3016

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.4-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9a0009bb76c3a81963914cb7f07e561536f3d963de66b383bce1e7506e4931b0
MD5 33fa69cfd64693b3121ab5340244a9ea
BLAKE2b-256 cc6cc4119cf929772c8dee824b5f4efbbab87a52b39fbb886a69dccdcec32ad0

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