Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

pixelmatch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixelmatch - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "pixelmatch",
"version": "2.0.0",
"version": "2.0.1",
"description": "The smallest and fastest pixel-level image comparison library.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,6 +9,8 @@ ## pixelmatch

Inspired by [Resemble.js](https://github.com/Huddle/Resemble.js) and
[Blink-diff](https://github.com/yahoo/blink-diff),
including features like anti-aliasing detection and perceptive color metrics.
Unlike these libraries, pixelmatch is under **100 lines of code**,
Features [anti-aliased pixels detection](http://www.ee.ktu.lt/journal/2009/7/25_ISSN_1392-1215_Anti-aliased%20Pxel%20and%20Intensity%20Slope%20Detector.pdf)
and [perceptual color metrics](https://en.wikipedia.org/wiki/YUV).
Inspired by [Resemble.js](https://github.com/Huddle/Resemble.js)
and [Blink-diff](https://github.com/yahoo/blink-diff).
Unlike these libraries, pixelmatch is around **120 lines of code**,
has **no dependencies**, and works on **raw arrays** of image data,

@@ -60,5 +62,5 @@ so it's **blazing fast** and can be used in **any environment** (Node or browsers).

| --- | --- | --- |
| ![](test/fixtures/1a.png) | ![](test/fixtures/b.png) | ![1diff](test/fixtures/1diff.png) |
| ![](test/fixtures/1a.png) | ![](test/fixtures/1b.png) | ![1diff](test/fixtures/1diff.png) |
| ![](https://pbs.twimg.com/media/CRYXm86VAAQxo-o.png) | ![](https://pbs.twimg.com/media/CRYXm9uUYAAIGAf.png) | ![](https://pbs.twimg.com/media/CRYXnAAUwAEsuzb.png) |
### [Changelog](https://github.com/mapbox/pixelmatch/releases)

@@ -16,18 +16,20 @@ 'use strict';

test(name, function (t) {
var img1 = readImage(imgPath1);
var img2 = readImage(imgPath2);
var expectedDiff = readImage(diffPath);
var img1 = readImage(imgPath1, function () {
var img2 = readImage(imgPath2, function () {
var expectedDiff = readImage(diffPath, function () {
var diff = new PNG({width: img1.width, height: img1.height});
var mismatch = match(img1.data, img2.data, diff.data, diff.width, diff.height, threshold, includeAA);
var diff = new PNG({width: img1.width, height: img1.height});
var mismatch = match(img1.data, img2.data, diff.data, diff.width, diff.height, threshold, includeAA);
t.same(diff.data, expectedDiff.data, 'diff image');
t.same(mismatch, expectedMismatch, 'number of mismatched pixels');
t.same(diff.data, expectedDiff.data, 'diff image');
t.same(mismatch, expectedMismatch, 'number of mismatched pixels');
t.end();
t.end();
});
});
});
});
}
function readImage(name) {
return PNG.sync.read(fs.readFileSync(path.join(__dirname, '/fixtures/' + name + '.png')));
function readImage(name, done) {
return fs.createReadStream(path.join(__dirname, '/fixtures/' + name + '.png')).pipe(new PNG()).on('parsed', done);
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc