Skip to Content
New: codec-png-native and codec-png-wasm bring the blazediff-png codec to Node and WebAssembly, faster than spng and jSquash. Read more β†’
Comparevs pixelmatch

BlazeDiff vs pixelmatch

@blazediff/core runs the pixelmatch algorithm with the pixelmatch call signature, and it is ~7.4x faster over our 34 fixtures. The WebAssembly build is ~6.8x faster. Switching is a one-line import change.

pixelmatch is the reference pixel diff for JavaScript: a few hundred lines, anti-aliasing detection, and a YIQ color delta. BlazeDiff started as a faster implementation of the same algorithm. It skips identical blocks of pixels before it runs the per-pixel delta, so unchanged areas cost almost nothing.

At a glance

pixelmatchBlazeDiff
LicenseISCMIT
ImplementationsJavaScript (plus a C++ port)JavaScript, WebAssembly, native Node, Python, Rust
InputRaw RGBA buffersRaw RGBA everywhere, plus file paths and encoded bytes in core-native
Decodes images itselfNo (CLI reads PNG through pngjs)core-native and Python decode PNG, JPEG and QOI
Color metricYIQ in 7.x, OKLab + HyAB in 8.0YIQ by default, OKLab + HyAB with metric: "oklab"
Anti-aliasingDetected (VyΕ‘niauskas 2009)Detected, same method
OutputDiff pixel count, diff imageDiff pixel count, diff image
Beyond pixel countsNoSSIM, GMSD, MILO scores and region analysis in sibling packages

Benchmarks

Decode is excluded for the JavaScript and WebAssembly charts, so they measure the diff kernel only. The charts use pixelmatch 7.2.0.

JavaScript (@blazediff/core vs pixelmatch) (image IO excluded)

TOTAL TIME Β· 34 FIXTURES Β· MEAN OF 50 RUNS Β· IO EXCLUDED

BlazeDiffOther librariesLower is better
#LibraryVersionTotal timevs Pixelmatch
1BlazeDiff2.0.0270ms7.36x faster
2Pixelmatch7.2.01.99sbaseline
Per-fixture results (34)
FixturePixelmatchBlazeDiffBlazeDiff vs Pixelmatch
4k/1334ms41.73ms8.00x
4k/1 (identical)23.22ms3.31ms7.01x
4k/2344ms55.57ms6.18x
4k/2 (identical)22.75ms3.48ms6.55x
4k/3414ms51.21ms8.09x
4k/3 (identical)27.63ms4.11ms6.72x
blazediff/11.27ms0.16ms8.01x
blazediff/1 (identical)0.50ms0.06ms8.50x
blazediff/21.80ms0.50ms3.58x
blazediff/2 (identical)0.40ms0.05ms8.40x
blazediff/310.87ms4.07ms2.67x
blazediff/3 (identical)1.92ms0.24ms8.09x
blazediff/412.01ms2.32ms5.19x
blazediff/4 (identical)4.64ms0.55ms8.39x
page/1148ms14.90ms9.96x
page/1 (identical)69.44ms9.63ms7.21x
page/2508ms66.39ms7.66x
page/2 (identical)50.59ms7.50ms6.74x
pixelmatch/10.61ms0.14ms4.26x
pixelmatch/1 (identical)0.15ms0.02ms8.42x
pixelmatch/22.17ms0.85ms2.57x
pixelmatch/2 (identical)0.07ms0.01ms6.93x
pixelmatch/30.38ms0.11ms3.36x
pixelmatch/3 (identical)0.15ms0.02ms8.07x
pixelmatch/44.51ms1.77ms2.56x
pixelmatch/4 (identical)0.19ms0.03ms7.20x
pixelmatch/50.19ms0.10ms1.95x
pixelmatch/5 (identical)0.08ms0.01ms8.11x
pixelmatch/60.75ms0.46ms1.62x
pixelmatch/6 (identical)0.08ms0.02ms3.48x
pixelmatch/71.25ms0.46ms2.74x
pixelmatch/7 (identical)0.29ms0.07ms4.28x
same/12.10ms0.27ms7.88x
same/1 (identical)2.09ms0.29ms7.10x
TOTAL1.99s270ms7.36x

pnpm benchmark core Β· Apple M1 Max Β· darwin/arm64 Β· Node v22.14.0 Β· rustc 1.97.1 (8bab26f4f 2026-07-14) Β· 2026-11-12 Β· 867ed3b-dirty

JavaScript with output buffer (@blazediff/core vs pixelmatch) (image IO excluded)

TOTAL TIME Β· 34 FIXTURES Β· MEAN OF 50 RUNS Β· IO EXCLUDED

BlazeDiffOther librariesLower is better
#LibraryVersionTotal timevs Pixelmatch
1BlazeDiff2.0.0723ms4.19x faster
2Pixelmatch7.2.03.03sbaseline
Per-fixture results (34)
FixturePixelmatchBlazeDiffBlazeDiff vs Pixelmatch
4k/1389ms74.32ms5.23x
4k/1 (identical)76.63ms34.66ms2.21x
4k/2398ms90.17ms4.41x
4k/2 (identical)81.53ms37.95ms2.15x
4k/3492ms99.26ms4.96x
4k/3 (identical)97.78ms46.69ms2.09x
blazediff/12.69ms0.63ms4.28x
blazediff/1 (identical)1.75ms0.53ms3.28x
blazediff/22.86ms0.85ms3.35x
blazediff/2 (identical)1.43ms0.36ms3.95x
blazediff/315.71ms6.72ms2.34x
blazediff/3 (identical)6.57ms2.88ms2.29x
blazediff/424.09ms4.91ms4.91x
blazediff/4 (identical)19.57ms3.17ms6.17x
page/1339ms73.08ms4.63x
page/1 (identical)238ms69.99ms3.40x
page/2643ms116ms5.53x
page/2 (identical)172ms50.72ms3.40x
pixelmatch/11.03ms0.27ms3.81x
pixelmatch/1 (identical)0.53ms0.15ms3.64x
pixelmatch/22.41ms1.01ms2.38x
pixelmatch/2 (identical)0.27ms0.13ms2.10x
pixelmatch/30.80ms0.23ms3.45x
pixelmatch/3 (identical)0.62ms0.13ms4.59x
pixelmatch/44.90ms2.09ms2.34x
pixelmatch/4 (identical)0.72ms0.28ms2.56x
pixelmatch/50.41ms0.24ms1.71x
pixelmatch/5 (identical)0.26ms0.14ms1.82x
pixelmatch/60.96ms0.57ms1.67x
pixelmatch/6 (identical)0.27ms0.11ms2.41x
pixelmatch/72.08ms0.85ms2.45x
pixelmatch/7 (identical)1.19ms0.45ms2.66x
same/17.07ms1.57ms4.51x
same/1 (identical)7.16ms1.66ms4.33x
TOTAL3.03s723ms4.19x

pnpm benchmark core Β· Apple M1 Max Β· darwin/arm64 Β· Node v22.14.0 Β· rustc 1.97.1 (8bab26f4f 2026-07-14) Β· 2026-11-12 Β· 867ed3b-dirty

WebAssembly (@blazediff/core-wasm vs pixelmatch) (image IO excluded)

TOTAL TIME Β· 34 FIXTURES Β· MEAN OF 25 RUNS Β· IO EXCLUDED

BlazeDiffOther librariesLower is better
#LibraryVersionTotal timevs Pixelmatch
1BlazeDiff (core-wasm)7.0.0307ms6.81x faster
2Pixelmatch7.2.02.09sbaseline
Per-fixture results (34)
FixturePixelmatchBlazeDiff (core-wasm)BlazeDiff (core-wasm) vs Pixelmatch
4k/1346ms34.73ms9.97x
4k/1 (identical)21.94ms4.33ms5.07x
4k/2338ms63.27ms5.35x
4k/2 (identical)33.00ms5.21ms6.33x
4k/3424ms44.48ms9.53x
4k/3 (identical)38.68ms5.34ms7.25x
blazediff/11.28ms0.18ms7.03x
blazediff/1 (identical)0.54ms0.07ms7.76x
blazediff/21.97ms0.55ms3.58x
blazediff/2 (identical)0.41ms0.05ms7.93x
blazediff/310.86ms5.94ms1.83x
blazediff/3 (identical)1.94ms0.29ms6.73x
blazediff/417.72ms3.53ms5.02x
blazediff/4 (identical)4.98ms1.05ms4.73x
page/1153ms35.20ms4.35x
page/1 (identical)71.84ms18.33ms3.92x
page/2529ms65.49ms8.08x
page/2 (identical)74.86ms12.27ms6.10x
pixelmatch/10.82ms0.10ms8.54x
pixelmatch/1 (identical)0.15ms0.02ms6.30x
pixelmatch/22.29ms1.37ms1.67x
pixelmatch/2 (identical)0.08ms0.01ms6.10x
pixelmatch/30.39ms0.10ms3.75x
pixelmatch/3 (identical)0.15ms0.02ms7.08x
pixelmatch/44.25ms2.84ms1.50x
pixelmatch/4 (identical)0.21ms0.03ms6.66x
pixelmatch/50.23ms0.05ms4.42x
pixelmatch/5 (identical)0.07ms0.01ms5.00x
pixelmatch/60.96ms0.64ms1.51x
pixelmatch/6 (identical)0.07ms0.01ms5.67x
pixelmatch/77.82ms0.58ms13.51x
pixelmatch/7 (identical)0.30ms0.04ms7.40x
same/12.01ms0.59ms3.40x
same/1 (identical)2.28ms0.55ms4.15x
TOTAL2.09s307ms6.81x

pnpm benchmark core-wasm Β· Apple M1 Max Β· darwin/arm64 Β· Node v22.14.0 Β· rustc 1.97.1 (8bab26f4f 2026-07-14) Β· 2026-11-12 Β· 867ed3b-dirty

Switching

@blazediff/core/pixelmatch has the same arguments, options, errors, counts and output bytes as pixelmatch 8.0.0, so you change the import and nothing else:

// Before import pixelmatch from "pixelmatch"; // After import pixelmatch from "@blazediff/core/pixelmatch"; const diffCount = pixelmatch(img1, img2, diff, width, height, { threshold: 0.1 });

For new code, diff from @blazediff/core returns a result object and uses the YIQ metric of pixelmatch 7.x by default. Pass metric: "oklab" for the 8.0 metric:

import { diff } from "@blazediff/core"; const result = diff(img1, img2, { output, metric: "oklab", window: 16 });

If your images come from files, @blazediff/core-native also decodes them, so the pngjs step goes away:

import { diff } from "@blazediff/core-native"; const result = await diff("baseline.png", "current.png", { output: "diff.png", threshold: 0.1, });

pixelmatch 8.0 changed its color metric to OKLab + HyAB, so its diff counts differ from 7.x. The @blazediff/core/pixelmatch adapter matches 8.0 exactly. diff matches 7.x by default and 8.0 with metric: "oklab".

Python

The PyPI pixelmatch package is a pure Python port by a different author. The blazediff wheel runs the Rust core and decodes the files itself. This chart includes image decode for both sides.

vs pixelmatch (pypi)

TOTAL TIME Β· 34 FIXTURES Β· MEAN OF 10 OR 25 RUNS Β· IO INCLUDED

BlazeDiffOther librariesLower is better
#LibraryVersionTotal timevs pixelmatch (pypi)
1BlazeDiff7.0.02.20s73.26x faster
2pixelmatch (pypi)0.4.0161.46sbaseline
Per-fixture results (34)
Fixturepixelmatch (pypi)BlazeDiffBlazeDiff vs pixelmatch (pypi)
4k/120.20s213ms95.02x
4k/1 (identical)596ms199ms2.99x
4k/223.28s280ms83.18x
4k/2 (identical)734ms242ms3.04x
4k/326.30s270ms97.28x
4k/3 (identical)792ms250ms3.17x
blazediff/1261ms1.13ms231.83x
blazediff/1 (identical)4.18ms1.03ms4.05x
blazediff/2271ms1.58ms171.10x
blazediff/2 (identical)3.81ms1.13ms3.37x
blazediff/31.50s19.03ms79.01x
blazediff/3 (identical)46.32ms15.52ms2.98x
blazediff/42.48s5.81ms426.47x
blazediff/4 (identical)28.76ms4.92ms5.85x
page/140.25s285ms141.01x
page/1 (identical)872ms266ms3.27x
page/242.52s73.36ms579.53x
page/2 (identical)179ms48.83ms3.66x
pixelmatch/188.66ms1.29ms68.63x
pixelmatch/1 (identical)2.86ms1.20ms2.37x
pixelmatch/2179ms1.58ms113.48x
pixelmatch/2 (identical)0.89ms0.54ms1.66x
pixelmatch/386.57ms1.05ms82.15x
pixelmatch/3 (identical)2.25ms1.05ms2.13x
pixelmatch/4377ms4.53ms83.24x
pixelmatch/4 (identical)5.69ms2.28ms2.49x
pixelmatch/544.24ms0.66ms66.93x
pixelmatch/5 (identical)1.13ms0.62ms1.82x
pixelmatch/6109ms1.64ms66.10x
pixelmatch/6 (identical)1.59ms0.86ms1.84x
pixelmatch/7193ms1.11ms173.58x
pixelmatch/7 (identical)1.53ms0.71ms2.15x
same/123.42ms3.55ms6.59x
same/1 (identical)25.54ms3.55ms7.19x
TOTAL161.46s2.20s73.26x

pnpm benchmark python-pixelmatch Β· Apple M1 Max Β· darwin/arm64 Β· Node v22.14.0 Β· rustc 1.97.1 (8bab26f4f 2026-07-14) Β· Python 3.11.14 Β· 2026-11-11 Β· eafe393-dirty

from blazediff import diff result = diff("baseline.png", "current.png", "diff.png", threshold=0.1)

When to keep pixelmatch

  • You want the smallest possible dependency and diff speed does not matter.
Last updated on