Pixel-by-pixel Comparison - Vanilla JavaScript
Compare two images pixel by pixel in pure JavaScript - no native binaries, no
WebAssembly. @blazediff/core runs anywhere JS runs (browser, Node, Deno, Bun,
edge) and is ~1.5Γ faster than pixelmatch. Reach for it when you want zero install
friction and portability over raw throughput. Need more speed? See
ππ Rust + WASM and
πππ Rust + N-API.
Installation
npm install @blazediff/coreExamples
Basic Comparison

Image 1

Image 2
Result
import blazediff from "@blazediff/core";
// loadImage can either be a browser function or a server function
const img1 = await loadImage(
"https://raw.githubusercontent.com/teimurjan/blazediff/refs/heads/main/fixtures/blazediff/3a.png"
);
const img2 = await loadImage(
"https://raw.githubusercontent.com/teimurjan/blazediff/refs/heads/main/fixtures/blazediff/3b.png"
);
const output = new Uint8Array(img1.width * img1.height * 4);
const width = img1.width;
const height = img1.height;
const diff = blazediff(img1, img2, output, width, height);See the full API reference β.
Last updated on