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 ssim.js

BlazeDiff vs ssim.js

@blazediff/ssim is ~21% faster than ssim.js on standard SSIM, and the native @blazediff/ssim-native is ~19.8x faster. Both take RGBA pixels and return a similarity score from 0 to 1. ssim.js is archived on GitHub, and its last release was 3.5.0 in 2020.

ssim.js is a JavaScript port of the Wang et al. MATLAB reference. It offers several variants, and its default (weber) trades accuracy for speed. BlazeDiff ships standard SSIM that matches MATLAB ssim.m with an error below 0.01%, plus MS-SSIM and Hitchhiker’s SSIM.

At a glance

ssim.jsBlazeDiff
LicenseMITMIT
StatusArchived, last release 2020Maintained
RuntimesNode, browsersNode, browsers, Deno, Bun (ssim); native Node (ssim-native)
InputImageData-like { data, width, height }RGBA buffers (ssim); file paths or encoded bytes (ssim-native)
Variantsoriginal, fast, bezkrovny, weberSSIM, MS-SSIM, Hitchhiker’s SSIM; perceptual SSIM in native
Score mapYes (ssim_map)Yes (grayscale map image)
Pass or fail resultNo, you compare the scoressim-native takes minScore and returns match

Benchmarks

The first chart compares standard SSIM against ssim.js fast. The second compares Hitchhiker’s SSIM against ssim.js weber, its fastest mode. Decode is excluded.

Fast Original ( @blazediff/ssim using ssim vs ssim.js using fast algorithm) (image IO excluded)

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

BlazeDiffOther librariesLower is better

Apple M1 Max Β· darwin/arm64 Β· Node v22.14.0 Β· rustc 1.97.1 (8bab26f4f 2026-07-14) Β· 2026-10-22 Β· 234b300-dirty Β· pnpm benchmark ssim

Per-fixture results (22)
Fixturessim.jsBlazeDiffBlazeDiff (ssim-native)BlazeDiff vs ssim.jsBlazeDiff (ssim-native) vs ssim.js
blazediff/192.94ms65.98ms5.36ms1.41x17.33x
blazediff/1 (identical)99.29ms65.49ms7.92ms1.52x12.54x
blazediff/239.45ms23.49ms1.55ms1.68x25.42x
blazediff/2 (identical)36.44ms24.04ms1.60ms1.52x22.77x
blazediff/3112ms98.71ms5.47ms1.13x20.44x
blazediff/3 (identical)106ms100ms5.03ms1.06x21.14x
blazediff/4259ms226ms12.26ms1.15x21.10x
blazediff/4 (identical)268ms229ms11.99ms1.17x22.31x
pixelmatch/128.25ms20.13ms1.63ms1.40x17.29x
pixelmatch/1 (identical)30.38ms19.79ms1.57ms1.54x19.34x
pixelmatch/213.92ms10.90ms0.87ms1.28x16.05x
pixelmatch/2 (identical)14.40ms9.96ms0.76ms1.45x19.06x
pixelmatch/330.00ms19.92ms1.60ms1.51x18.74x
pixelmatch/3 (identical)28.97ms19.86ms1.63ms1.46x17.73x
pixelmatch/419.65ms11.76ms0.79ms1.67x24.77x
pixelmatch/4 (identical)20.60ms11.88ms0.81ms1.73x25.50x
pixelmatch/514.34ms10.15ms0.76ms1.41x18.93x
pixelmatch/5 (identical)15.07ms9.94ms0.78ms1.52x19.33x
pixelmatch/614.38ms9.98ms0.76ms1.44x18.95x
pixelmatch/6 (identical)13.79ms10.70ms0.77ms1.29x17.89x
pixelmatch/727.20ms16.64ms1.32ms1.63x20.65x
pixelmatch/7 (identical)27.96ms16.63ms1.10ms1.68x25.41x
TOTAL1.31s1.03s66.34ms1.27x19.77x

Hitchhikers SSIM SSIM (@blazediff/ssim using hitchhikers-ssim vs ssim.js using weber algorithm) (image IO excluded)

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

BlazeDiffOther librariesLower is better

Apple M1 Max Β· darwin/arm64 Β· Node v22.14.0 Β· rustc 1.97.1 (8bab26f4f 2026-07-14) Β· 2026-10-22 Β· 234b300-dirty Β· pnpm benchmark hitchhikers-ssim

Per-fixture results (22)
Fixturessim.jsBlazeDiffBlazeDiff (ssim-native)BlazeDiff vs ssim.jsBlazeDiff (ssim-native) vs ssim.js
blazediff/177.27ms12.38ms2.92ms6.24x26.42x
blazediff/1 (identical)77.43ms12.44ms3.06ms6.22x25.33x
blazediff/235.29ms10.04ms2.33ms3.52x15.16x
blazediff/2 (identical)40.30ms10.45ms2.50ms3.86x16.12x
blazediff/3123ms47.14ms10.91ms2.62x11.31x
blazediff/3 (identical)125ms47.55ms11.03ms2.62x11.29x
blazediff/4302ms112ms25.70ms2.69x11.73x
blazediff/4 (identical)316ms110ms25.09ms2.88x12.59x
pixelmatch/122.72ms3.75ms0.84ms6.07x27.10x
pixelmatch/1 (identical)23.13ms3.91ms0.88ms5.91x26.17x
pixelmatch/211.31ms1.88ms0.40ms6.02x28.14x
pixelmatch/2 (identical)11.50ms1.91ms0.40ms6.01x28.48x
pixelmatch/322.96ms3.75ms0.84ms6.12x27.40x
pixelmatch/3 (identical)23.90ms3.75ms0.84ms6.38x28.36x
pixelmatch/418.61ms5.15ms1.16ms3.61x15.97x
pixelmatch/4 (identical)18.70ms5.44ms1.18ms3.44x15.88x
pixelmatch/511.38ms1.92ms0.41ms5.94x27.75x
pixelmatch/5 (identical)11.78ms1.86ms0.40ms6.32x29.19x
pixelmatch/611.37ms1.96ms0.43ms5.81x26.69x
pixelmatch/6 (identical)11.91ms1.89ms0.40ms6.29x29.62x
pixelmatch/724.87ms8.65ms1.71ms2.87x14.55x
pixelmatch/7 (identical)25.05ms7.20ms1.64ms3.48x15.24x
TOTAL1.34s414ms95.09ms3.24x14.14x

Hitchhiker’s SSIM is ~3.2x faster than ssim.js weber in JavaScript.

Switching

ssim.js takes two image objects. @blazediff/ssim takes the two pixel buffers and the size, in the same order as a pixel diff.

// Before import ssim from "ssim.js"; const { mssim } = ssim(img1, img2); // After import ssim from "@blazediff/ssim/ssim"; const score = ssim(img1.data, img2.data, undefined, img1.width, img1.height);

Scores from different SSIM variants are not interchangeable. If you gated tests on an ssim.js weber score, measure your fixtures again before you copy the threshold.

When to keep ssim.js

  • You depend on the bezkrovny or weber variant scores exactly.
  • You use its UQI mode (k1 and k2 set to 0).
Last updated on