Skip to Content
New: @blazediff/agent - agentic visual regression your coding agent can judge. Read more β†’
DocsPixel-by-pixel Image ComparisonπŸ†πŸ†πŸ† Rust + N-API in Node

Pixel-by-pixel Comparison - Rust + N-API in Node

The fastest path: native Rust compiled to a Node addon via N-API, ~3-4Γ— faster than odiff. @blazediff/core-native works on file paths - it decodes PNG, JPEG, and QOI itself (in parallel) and can write the diff image straight to disk. Reach for it in Node test runners and CI where you have files and want maximum throughput.

Installation

npm install @blazediff/core-native

Examples

Fixture A

Image 1

Fixture B

Image 2

Result

import { compare } from "@blazediff/core-native"; const result = await compare("3a.png", "3b.png"); if (result.match) { console.log("identical"); } else if (result.reason === "pixel-diff") { console.log(`${result.diffCount} pixels differ (${result.diffPercentage.toFixed(2)}%)`); } else if (result.reason === "layout-diff") { console.log("dimensions differ"); }

Want a verdict on what changed, not just how many pixels? Pass interpret: true or use the dedicated Image Difference Analysis β†’ example. Full options in the API reference β†’.

Last updated on