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

Uploaded CPython 3.8+Windows ARM64

blazediff-5.0.0-cp38-abi3-win_amd64.whl (460.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

blazediff-5.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (607.6 kB view details)

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

blazediff-5.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (580.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

blazediff-5.0.0-cp38-abi3-macosx_11_0_arm64.whl (525.0 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

blazediff-5.0.0-cp38-abi3-macosx_10_12_x86_64.whl (539.5 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for blazediff-5.0.0-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 e41e707676485091a86490ab41124af4c1f275cf7b098874c604114c7f319d21
MD5 109b40767aebce1a8e49cec4fc4f1123
BLAKE2b-256 1e06288c9d407c3a3b81002f65bbabb978ca11709d92a7c5fdc38f50fb842fc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blazediff-5.0.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 460.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-5.0.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a79d796695ea62f11fd018b040f21670842be1412a7ace5bc51c650f72533046
MD5 82889d0474d8b27ba9af4385dfaa6ec0
BLAKE2b-256 730a18babecf68c5fdd77d59563c43504664f3b7a474e554a756c03f15dea9b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-5.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b1c9c9474ea1377a0e111bb4c44cf67f5a5f2e31861d0030a7c78db96ce618a
MD5 ca2221833eb29ba72491cacf1cd62cb5
BLAKE2b-256 7d1dab0cb5f843c67011189f0916a7738fdc342a10769e39fc299177bc93c21d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-5.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 07415ca79de56707aec2794482e7c1a6d1ac7476497f704f8dead06804ff5e32
MD5 7e35851ace0ac977f2aa0ae0f4208d22
BLAKE2b-256 d175e7107c9b46810eb730649196e012a3cb8ac05a273805c5cd0eb1cc45ea08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-5.0.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d18ccf91f50a0219c66bbe7106d02be82c72656a20642892d65f72e83d2073e2
MD5 1aadfad942d87882c749271150897fad
BLAKE2b-256 28f666d94c2597085643183d260243ddf33bde47b32eeec5b437902bb284c2db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-5.0.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fd6b4ef4edb85793402978061b76f552487a35e3a10299690b30e5b41dd4ad0f
MD5 ba775cb95923c41846518fd5b4ea2014
BLAKE2b-256 b466487be18c894d02ec803e0092b428707877cfcc7c33f94ab322daf6b9e01e

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