Skip to Content
New: @blazediff/agent - agentic visual regression your coding agent can judge. Read more β†’
DocsPixel-by-pixel Image ComparisonπŸ† Vanilla JavaScript

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/core

Examples

Fixture A

Image 1

Fixture B

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