New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

resemblejs

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resemblejs - npm Package Compare versions

Comparing version 2.2.5 to 2.2.6

2

package.json
{
"name": "resemblejs",
"version": "2.2.5",
"version": "2.2.6",
"description": "Image analysis and comparison with HTML5",

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

@@ -80,2 +80,16 @@ Resemble.js

It is possible to narrow down the area of comparison, by specifying a bounding box measured in pixels from the top left:
```javascript
resemble.outputSettings({
boundingBox: {
left: 100,
top: 200,
right: 200,
bottom: 600
}
});
// resembleControl.repaint();
```
By default, the comparison algorithm skips pixels when the image width or height is larger than 1200 pixels. This is there to mitigate performance issues.

@@ -82,0 +96,0 @@

@@ -32,2 +32,13 @@ /*

function withinBoundingBox(x, y, width, height) {
if (!boundingBox) {
return true;
}
return x > (boundingBox.left || 0) &&
x < (boundingBox.right || width) &&
y > (boundingBox.top || 0) &&
y < (boundingBox.bottom || height);
}
var errorPixelTransform = {

@@ -63,2 +74,3 @@ flat: function (px, offset, d1, d2) {

var errorPixel = errorPixelTransform.flat;
var boundingBox;
var largeImageThreshold = 1200;

@@ -442,2 +454,3 @@ var useCrossOrigin = true;

var offset = (verticalPos*width + horizontalPos) * 4;
var isWithinBoundingBox = withinBoundingBox(horizontalPos, verticalPos, width, height);

@@ -453,3 +466,3 @@ if (!getPixelInfo(pixel1, data1, offset, 1) || !getPixelInfo(pixel2, data2, offset, 2)) {

if( isPixelBrightnessSimilar(pixel1, pixel2) ){
if( isPixelBrightnessSimilar(pixel1, pixel2) || !isWithinBoundingBox ){
copyGrayScalePixel(targetPix, offset, pixel2);

@@ -464,3 +477,3 @@ } else {

if( isRGBSimilar(pixel1, pixel2) ){
if( isRGBSimilar(pixel1, pixel2) || !isWithinBoundingBox ){
copyPixel(targetPix, offset, pixel1, pixel2);

@@ -475,3 +488,3 @@

if( isPixelBrightnessSimilar(pixel1, pixel2) ){
if( isPixelBrightnessSimilar(pixel1, pixel2) || !isWithinBoundingBox ){
copyGrayScalePixel(targetPix, offset, pixel2);

@@ -736,2 +749,6 @@ } else {

if (options.boundingBox !== undefined) {
boundingBox = options.boundingBox;
}
return this;

@@ -738,0 +755,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