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

Uploaded CPython 3.8+Windows ARM64

blazediff-4.3.2-cp38-abi3-win_amd64.whl (493.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

blazediff-4.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (638.6 kB view details)

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

blazediff-4.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (608.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

blazediff-4.3.2-cp38-abi3-macosx_11_0_arm64.whl (554.8 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

blazediff-4.3.2-cp38-abi3-macosx_10_12_x86_64.whl (570.0 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: blazediff-4.3.2-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 491.0 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.2-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 14e10569cc0d0e2391a08450d777ade40a2d039fb87c2adc81089e749b72e363
MD5 82764c7ee18221e5ff4e0173bb97e886
BLAKE2b-256 05f041405d6a17e47cca96b2e114f47b36cbba5cf4d258176712887f60b65f6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blazediff-4.3.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 493.6 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.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e35342663e4f22e0bf8b71d283a5ccd59708686e3ba545076186447dc88c0565
MD5 ba24628083a13478d375acecbe7a3ddd
BLAKE2b-256 e4fb29b9d8944aa401ca24a7229b548441ddafc586c1555db3659884ebd88914

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd8efad5918f9a0c2036938c08b25041da2b5b0a9e7a890864802222cb5aaba7
MD5 2ca94db9f00e76f09fd759c637790401
BLAKE2b-256 499424ba3612edc7ddfb647efd4398d59e1c86231768f69bc1abfba2370b67a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0e5537d3d58b7877d313c9792fb72347c74c9b119b9201af364db2595af9ebe
MD5 11108cc82b4e372add0b83f6484bf18f
BLAKE2b-256 10d8dcae07316492c0ab571f1db25e76258248841827a1889e33c829bba01e06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49b3a520fb1cb4bb0da60e7c5c721aeddd840d1d78fa6cc88314b7a514e1b090
MD5 b155117e68e2302992d4ee350a69f911
BLAKE2b-256 27e9b7a915e36fd7839f83708011a39e0328bc4eb6e940527e255839e8ed165d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 12ac57113e785011954915af1113f34d0fc9ba0db95126fe3e90355dec8d148d
MD5 a37093263564fc272a0b652ed2b175be
BLAKE2b-256 8e0510d193ed25e54953622db515d9a952cfd13306343c9cf0938c252711046f

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