resemblejs
Advanced tools
{ | ||
"name": "resemblejs", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Image analysis and comparison with HTML5", | ||
@@ -5,0 +5,0 @@ "main": "resemble.js", |
@@ -48,2 +48,8 @@ Resemble.js | ||
Scale second image to dimensions of the first one: | ||
```javascript | ||
//diff.useOriginalSize(); | ||
diff.scaleToSameSize(); | ||
``` | ||
You can also change the comparison method after the first analysis. | ||
@@ -57,2 +63,3 @@ | ||
And change the output display style. | ||
@@ -59,0 +66,0 @@ |
@@ -91,2 +91,3 @@ /* | ||
var ignoreColors = false; | ||
var scaleToSameSize = false; | ||
@@ -148,6 +149,12 @@ function triggerDataUpdate(){ | ||
if (httpRegex.test(fileData) && !documentDomainRegex.test(fileData)) { | ||
hiddenImage.setAttribute('crossorigin', 'anonymous'); | ||
if (!(typeof fileData === 'string' | ||
&& fileData.length > 6 | ||
&& fileData.charAt(4)===':' | ||
&& fileData.charAt(5)!=='/' | ||
)) { | ||
if (httpRegex.test(fileData) && !documentDomainRegex.test(fileData)) { | ||
hiddenImage.setAttribute('crossorigin', 'anonymous'); | ||
} | ||
} | ||
hiddenImage.onerror = function () { | ||
@@ -164,2 +171,8 @@ hiddenImage.onerror = null; //fixes pollution between calls | ||
var imageData; | ||
if( scaleToSameSize && images.length == 1 ){ | ||
hiddenImage.width = images[0].width; | ||
hiddenImage.height = images[0].height; | ||
} | ||
var width = hiddenImage.width; | ||
@@ -584,2 +597,14 @@ var height = hiddenImage.height; | ||
var self = { | ||
scaleToSameSize: function(){ | ||
scaleToSameSize = true; | ||
if(hasMethod) { param(); } | ||
return self; | ||
}, | ||
useOriginalSize: function(){ | ||
scaleToSameSize = false; | ||
if(hasMethod) { param(); } | ||
return self; | ||
}, | ||
ignoreNothing: function(){ | ||
@@ -586,0 +611,0 @@ |
Sorry, the diff of this file is not supported yet
121473
5.18%908
2.37%86
8.86%