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
| pixelmatch | BlazeDiff | |
|---|---|---|
| License | ISC | MIT |
| Implementations | JavaScript (plus a C++ port) | JavaScript, WebAssembly, native Node, Python, Rust |
| Input | Raw RGBA buffers | Raw RGBA everywhere, plus file paths and encoded bytes in core-native |
| Decodes images itself | No (CLI reads PNG through pngjs) | core-native and Python decode PNG, JPEG and QOI |
| Color metric | YIQ in 7.x, OKLab + HyAB in 8.0 | YIQ by default, OKLab + HyAB with metric: "oklab" |
| Anti-aliasing | Detected (VyΕ‘niauskas 2009) | Detected, same method |
| Output | Diff pixel count, diff image | Diff pixel count, diff image |
| Beyond pixel counts | No | SSIM, 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
| # | Library | Version | Total time | vs Pixelmatch |
|---|---|---|---|---|
| 1 | BlazeDiff | 2.0.0 | 270ms | 7.36x faster |
| 2 | Pixelmatch | 7.2.0 | 1.99s | baseline |
Per-fixture results (34)
| Fixture | Pixelmatch | BlazeDiff | BlazeDiff vs Pixelmatch |
|---|---|---|---|
| 4k/1 | 334ms | 41.73ms | 8.00x |
| 4k/1 (identical) | 23.22ms | 3.31ms | 7.01x |
| 4k/2 | 344ms | 55.57ms | 6.18x |
| 4k/2 (identical) | 22.75ms | 3.48ms | 6.55x |
| 4k/3 | 414ms | 51.21ms | 8.09x |
| 4k/3 (identical) | 27.63ms | 4.11ms | 6.72x |
| blazediff/1 | 1.27ms | 0.16ms | 8.01x |
| blazediff/1 (identical) | 0.50ms | 0.06ms | 8.50x |
| blazediff/2 | 1.80ms | 0.50ms | 3.58x |
| blazediff/2 (identical) | 0.40ms | 0.05ms | 8.40x |
| blazediff/3 | 10.87ms | 4.07ms | 2.67x |
| blazediff/3 (identical) | 1.92ms | 0.24ms | 8.09x |
| blazediff/4 | 12.01ms | 2.32ms | 5.19x |
| blazediff/4 (identical) | 4.64ms | 0.55ms | 8.39x |
| page/1 | 148ms | 14.90ms | 9.96x |
| page/1 (identical) | 69.44ms | 9.63ms | 7.21x |
| page/2 | 508ms | 66.39ms | 7.66x |
| page/2 (identical) | 50.59ms | 7.50ms | 6.74x |
| pixelmatch/1 | 0.61ms | 0.14ms | 4.26x |
| pixelmatch/1 (identical) | 0.15ms | 0.02ms | 8.42x |
| pixelmatch/2 | 2.17ms | 0.85ms | 2.57x |
| pixelmatch/2 (identical) | 0.07ms | 0.01ms | 6.93x |
| pixelmatch/3 | 0.38ms | 0.11ms | 3.36x |
| pixelmatch/3 (identical) | 0.15ms | 0.02ms | 8.07x |
| pixelmatch/4 | 4.51ms | 1.77ms | 2.56x |
| pixelmatch/4 (identical) | 0.19ms | 0.03ms | 7.20x |
| pixelmatch/5 | 0.19ms | 0.10ms | 1.95x |
| pixelmatch/5 (identical) | 0.08ms | 0.01ms | 8.11x |
| pixelmatch/6 | 0.75ms | 0.46ms | 1.62x |
| pixelmatch/6 (identical) | 0.08ms | 0.02ms | 3.48x |
| pixelmatch/7 | 1.25ms | 0.46ms | 2.74x |
| pixelmatch/7 (identical) | 0.29ms | 0.07ms | 4.28x |
| same/1 | 2.10ms | 0.27ms | 7.88x |
| same/1 (identical) | 2.09ms | 0.29ms | 7.10x |
| TOTAL | 1.99s | 270ms | 7.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
| # | Library | Version | Total time | vs Pixelmatch |
|---|---|---|---|---|
| 1 | BlazeDiff | 2.0.0 | 723ms | 4.19x faster |
| 2 | Pixelmatch | 7.2.0 | 3.03s | baseline |
Per-fixture results (34)
| Fixture | Pixelmatch | BlazeDiff | BlazeDiff vs Pixelmatch |
|---|---|---|---|
| 4k/1 | 389ms | 74.32ms | 5.23x |
| 4k/1 (identical) | 76.63ms | 34.66ms | 2.21x |
| 4k/2 | 398ms | 90.17ms | 4.41x |
| 4k/2 (identical) | 81.53ms | 37.95ms | 2.15x |
| 4k/3 | 492ms | 99.26ms | 4.96x |
| 4k/3 (identical) | 97.78ms | 46.69ms | 2.09x |
| blazediff/1 | 2.69ms | 0.63ms | 4.28x |
| blazediff/1 (identical) | 1.75ms | 0.53ms | 3.28x |
| blazediff/2 | 2.86ms | 0.85ms | 3.35x |
| blazediff/2 (identical) | 1.43ms | 0.36ms | 3.95x |
| blazediff/3 | 15.71ms | 6.72ms | 2.34x |
| blazediff/3 (identical) | 6.57ms | 2.88ms | 2.29x |
| blazediff/4 | 24.09ms | 4.91ms | 4.91x |
| blazediff/4 (identical) | 19.57ms | 3.17ms | 6.17x |
| page/1 | 339ms | 73.08ms | 4.63x |
| page/1 (identical) | 238ms | 69.99ms | 3.40x |
| page/2 | 643ms | 116ms | 5.53x |
| page/2 (identical) | 172ms | 50.72ms | 3.40x |
| pixelmatch/1 | 1.03ms | 0.27ms | 3.81x |
| pixelmatch/1 (identical) | 0.53ms | 0.15ms | 3.64x |
| pixelmatch/2 | 2.41ms | 1.01ms | 2.38x |
| pixelmatch/2 (identical) | 0.27ms | 0.13ms | 2.10x |
| pixelmatch/3 | 0.80ms | 0.23ms | 3.45x |
| pixelmatch/3 (identical) | 0.62ms | 0.13ms | 4.59x |
| pixelmatch/4 | 4.90ms | 2.09ms | 2.34x |
| pixelmatch/4 (identical) | 0.72ms | 0.28ms | 2.56x |
| pixelmatch/5 | 0.41ms | 0.24ms | 1.71x |
| pixelmatch/5 (identical) | 0.26ms | 0.14ms | 1.82x |
| pixelmatch/6 | 0.96ms | 0.57ms | 1.67x |
| pixelmatch/6 (identical) | 0.27ms | 0.11ms | 2.41x |
| pixelmatch/7 | 2.08ms | 0.85ms | 2.45x |
| pixelmatch/7 (identical) | 1.19ms | 0.45ms | 2.66x |
| same/1 | 7.07ms | 1.57ms | 4.51x |
| same/1 (identical) | 7.16ms | 1.66ms | 4.33x |
| TOTAL | 3.03s | 723ms | 4.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
| # | Library | Version | Total time | vs Pixelmatch |
|---|---|---|---|---|
| 1 | BlazeDiff (core-wasm) | 7.0.0 | 307ms | 6.81x faster |
| 2 | Pixelmatch | 7.2.0 | 2.09s | baseline |
Per-fixture results (34)
| Fixture | Pixelmatch | BlazeDiff (core-wasm) | BlazeDiff (core-wasm) vs Pixelmatch |
|---|---|---|---|
| 4k/1 | 346ms | 34.73ms | 9.97x |
| 4k/1 (identical) | 21.94ms | 4.33ms | 5.07x |
| 4k/2 | 338ms | 63.27ms | 5.35x |
| 4k/2 (identical) | 33.00ms | 5.21ms | 6.33x |
| 4k/3 | 424ms | 44.48ms | 9.53x |
| 4k/3 (identical) | 38.68ms | 5.34ms | 7.25x |
| blazediff/1 | 1.28ms | 0.18ms | 7.03x |
| blazediff/1 (identical) | 0.54ms | 0.07ms | 7.76x |
| blazediff/2 | 1.97ms | 0.55ms | 3.58x |
| blazediff/2 (identical) | 0.41ms | 0.05ms | 7.93x |
| blazediff/3 | 10.86ms | 5.94ms | 1.83x |
| blazediff/3 (identical) | 1.94ms | 0.29ms | 6.73x |
| blazediff/4 | 17.72ms | 3.53ms | 5.02x |
| blazediff/4 (identical) | 4.98ms | 1.05ms | 4.73x |
| page/1 | 153ms | 35.20ms | 4.35x |
| page/1 (identical) | 71.84ms | 18.33ms | 3.92x |
| page/2 | 529ms | 65.49ms | 8.08x |
| page/2 (identical) | 74.86ms | 12.27ms | 6.10x |
| pixelmatch/1 | 0.82ms | 0.10ms | 8.54x |
| pixelmatch/1 (identical) | 0.15ms | 0.02ms | 6.30x |
| pixelmatch/2 | 2.29ms | 1.37ms | 1.67x |
| pixelmatch/2 (identical) | 0.08ms | 0.01ms | 6.10x |
| pixelmatch/3 | 0.39ms | 0.10ms | 3.75x |
| pixelmatch/3 (identical) | 0.15ms | 0.02ms | 7.08x |
| pixelmatch/4 | 4.25ms | 2.84ms | 1.50x |
| pixelmatch/4 (identical) | 0.21ms | 0.03ms | 6.66x |
| pixelmatch/5 | 0.23ms | 0.05ms | 4.42x |
| pixelmatch/5 (identical) | 0.07ms | 0.01ms | 5.00x |
| pixelmatch/6 | 0.96ms | 0.64ms | 1.51x |
| pixelmatch/6 (identical) | 0.07ms | 0.01ms | 5.67x |
| pixelmatch/7 | 7.82ms | 0.58ms | 13.51x |
| pixelmatch/7 (identical) | 0.30ms | 0.04ms | 7.40x |
| same/1 | 2.01ms | 0.59ms | 3.40x |
| same/1 (identical) | 2.28ms | 0.55ms | 4.15x |
| TOTAL | 2.09s | 307ms | 6.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
| # | Library | Version | Total time | vs pixelmatch (pypi) |
|---|---|---|---|---|
| 1 | BlazeDiff | 7.0.0 | 2.20s | 73.26x faster |
| 2 | pixelmatch (pypi) | 0.4.0 | 161.46s | baseline |
Per-fixture results (34)
| Fixture | pixelmatch (pypi) | BlazeDiff | BlazeDiff vs pixelmatch (pypi) |
|---|---|---|---|
| 4k/1 | 20.20s | 213ms | 95.02x |
| 4k/1 (identical) | 596ms | 199ms | 2.99x |
| 4k/2 | 23.28s | 280ms | 83.18x |
| 4k/2 (identical) | 734ms | 242ms | 3.04x |
| 4k/3 | 26.30s | 270ms | 97.28x |
| 4k/3 (identical) | 792ms | 250ms | 3.17x |
| blazediff/1 | 261ms | 1.13ms | 231.83x |
| blazediff/1 (identical) | 4.18ms | 1.03ms | 4.05x |
| blazediff/2 | 271ms | 1.58ms | 171.10x |
| blazediff/2 (identical) | 3.81ms | 1.13ms | 3.37x |
| blazediff/3 | 1.50s | 19.03ms | 79.01x |
| blazediff/3 (identical) | 46.32ms | 15.52ms | 2.98x |
| blazediff/4 | 2.48s | 5.81ms | 426.47x |
| blazediff/4 (identical) | 28.76ms | 4.92ms | 5.85x |
| page/1 | 40.25s | 285ms | 141.01x |
| page/1 (identical) | 872ms | 266ms | 3.27x |
| page/2 | 42.52s | 73.36ms | 579.53x |
| page/2 (identical) | 179ms | 48.83ms | 3.66x |
| pixelmatch/1 | 88.66ms | 1.29ms | 68.63x |
| pixelmatch/1 (identical) | 2.86ms | 1.20ms | 2.37x |
| pixelmatch/2 | 179ms | 1.58ms | 113.48x |
| pixelmatch/2 (identical) | 0.89ms | 0.54ms | 1.66x |
| pixelmatch/3 | 86.57ms | 1.05ms | 82.15x |
| pixelmatch/3 (identical) | 2.25ms | 1.05ms | 2.13x |
| pixelmatch/4 | 377ms | 4.53ms | 83.24x |
| pixelmatch/4 (identical) | 5.69ms | 2.28ms | 2.49x |
| pixelmatch/5 | 44.24ms | 0.66ms | 66.93x |
| pixelmatch/5 (identical) | 1.13ms | 0.62ms | 1.82x |
| pixelmatch/6 | 109ms | 1.64ms | 66.10x |
| pixelmatch/6 (identical) | 1.59ms | 0.86ms | 1.84x |
| pixelmatch/7 | 193ms | 1.11ms | 173.58x |
| pixelmatch/7 (identical) | 1.53ms | 0.71ms | 2.15x |
| same/1 | 23.42ms | 3.55ms | 6.59x |
| same/1 (identical) | 25.54ms | 3.55ms | 7.19x |
| TOTAL | 161.46s | 2.20s | 73.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.