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

looks-same

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

looks-same - npm Package Compare versions

Comparing version 2.2.2 to 3.0.0

.idea/encodings.xml

6

CHANGELOG.md
# Changelog
## 3.0.0 - 2016-07-13
* Remove support for 0.10 and 0.12 NodeJS versions.
* Fix ignore caret on devices with `pixelRatio` > 1.
* Fix bug with the missed 1px diff between images when `ignoreCaret` option is enabled.
## 2.2.2 - 2015-12-19

@@ -4,0 +10,0 @@

23

index.js
'use strict';
var parseColor = require('parse-color'),
colorDiff = require('color-diff'),
png = require('./png');
png = require('./lib/png'),
IgnoreCaretComparator = require('./lib/ignore-caret-comparator');

@@ -73,3 +74,3 @@ var JND = 2.3; //Just noticable difference

if (opts.ignoreCaret) {
comparator = makeNoCaretColorComparator(comparator);
comparator = makeNoCaretColorComparator(comparator, opts.pixelRatio);
}

@@ -80,17 +81,5 @@

function makeNoCaretColorComparator(comparator) {
var prevFailure = null;
return function compareNoCaret(color1, color2, x, y) {
if (comparator(color1, color2, x, y)) {
return true;
}
if (prevFailure) {
if (x !== prevFailure.x || y !== prevFailure.y + 1) {
return false;
}
}
prevFailure = {x: x, y: y};
return true;
};
function makeNoCaretColorComparator(comparator, pixelRatio) {
const caretComparator = new IgnoreCaretComparator(comparator, pixelRatio);
return (color1, color2, x, y) => caretComparator.compare(color1, color2, x, y);
}

@@ -97,0 +86,0 @@

{
"name": "looks-same",
"version": "2.2.2",
"version": "3.0.0",
"description": "Pure node.js library for comparing PNG-images, taking into account human color perception.",

@@ -26,2 +26,5 @@ "main": "index.js",

},
"engines": {
"node": ">= 4.0"
},
"author": "Sergey Tatarintsev <sevinf@yandex-team.ru> (https://github.com/SevInf)",

@@ -28,0 +31,0 @@ "license": "MIT",

@@ -56,2 +56,12 @@ # LooksSame

Some devices can have different proportion between physical and logical screen resolutions also
known as `pixel ratio`. Default value for this proportion is 1.
This param also affects the comparison result, so it can be set manually with `pixelRatio` option.
```javascript
looksSame('image1.png', 'image2.png', {pixelRatio: 2}, function(error, equal) {
...
});
```
## Building diff image

@@ -58,0 +68,0 @@

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