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

Uploaded CPython 3.8+Windows ARM64

blazediff-4.3.3-cp38-abi3-win_amd64.whl (492.3 kB view details)

Uploaded CPython 3.8+Windows x86-64

blazediff-4.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (637.5 kB view details)

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

blazediff-4.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (608.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

blazediff-4.3.3-cp38-abi3-macosx_11_0_arm64.whl (553.8 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

blazediff-4.3.3-cp38-abi3-macosx_10_12_x86_64.whl (568.8 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: blazediff-4.3.3-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.3-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 c9a339a7bf71e39cb41c66394bd170966143b090b7b5993a2e3046279c445176
MD5 a4b44bd51b3f8a1710de25c56e73de00
BLAKE2b-256 26f94ac6bb207daab19d2e8a213a0d2e4639b47d7dd71c9d96cf33de028eb7ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blazediff-4.3.3-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 492.3 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.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6665dd60f45d34a61ae0b684de50d00d3515b9341f6a97ef7541b6cff2e3b834
MD5 fa2ac3830945666947618903d4b66bc0
BLAKE2b-256 e35b765070d55b09e55fae87d6a2ac0b7f55fed3c235672a28346d59880a7e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58f6c9fca3a52891a2099a1be903675f54936ce04f74e73920bab9a645de7aa6
MD5 f0b4cd508a818ba8f6c02f56b229defc
BLAKE2b-256 a7221394f2508dacfb7ca7fa18e9651d0f270572b68a81560d966c1482f28d6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7eda26aeef47b1ab35ce59100dd05d7471ab0be070729a5d1d6933255dd72b8f
MD5 801bf752c9f1d808f1f3a17d17288778
BLAKE2b-256 b694b7228b25464a094a4a8325f943b964e3069fc9f4b765217773f4df3b3e78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86b7f59b350582f514a91f42f8e90a8ed232fb496bb4ed755d495335ec8d6836
MD5 4977d27c50dde6a9d6fdead8eb80be60
BLAKE2b-256 4de7770f418464fe16b38d6b0c86f472b3ac1745c8796916f88d436fa2dea911

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blazediff-4.3.3-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 276e4e2e5db44ef8d78ac5dac445099a1a7a7340f8230245b9bda23f37b6fd80
MD5 dd4811faf7dffbcc2de158dcdc225363
BLAKE2b-256 975967a0e6a1dff3777fe6c66d4006a027f4d51b2935a53c1f989a5485fdaf51

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