resemblejs
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "resemblejs", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Image analysis and comparison with HTML5", | ||
@@ -5,0 +5,0 @@ "main": "resemble.js", |
@@ -66,3 +66,4 @@ Resemble.js | ||
errorType: 'movement', | ||
transparency: 0.3 | ||
transparency: 0.3, | ||
largeImageThreshold: 1200 | ||
}); | ||
@@ -72,4 +73,8 @@ // 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. | ||
You can switch this modify this behaviour by setting the `largeImageThreshold` option to a different value. Set it to **0** to switch it off completely. | ||
-------------------------------------- | ||
Created by [James Cryer](http://github.com/jamescryer) and the Huddle development team. | ||
Created by [James Cryer](http://github.com/jamescryer) and the Huddle development team. |
@@ -36,5 +36,7 @@ /* | ||
}; | ||
var errorPixelTransformer = errorPixelTransform.flat; | ||
var largeImageThreshold = 1200; | ||
_this['resemble'] = function( fileData ){ | ||
@@ -80,3 +82,3 @@ | ||
var pixleCount = 0; | ||
var pixelCount = 0; | ||
var redTotal = 0; | ||
@@ -94,3 +96,3 @@ var greenTotal = 0; | ||
pixleCount++; | ||
pixelCount++; | ||
@@ -103,6 +105,6 @@ redTotal += red / 255 * 100; | ||
data.red = Math.floor(redTotal / pixleCount); | ||
data.green = Math.floor(greenTotal / pixleCount); | ||
data.blue = Math.floor(blueTotal / pixleCount); | ||
data.brightness = Math.floor(brightnessTotal / pixleCount); | ||
data.red = Math.floor(redTotal / pixelCount); | ||
data.green = Math.floor(greenTotal / pixelCount); | ||
data.blue = Math.floor(blueTotal / pixelCount); | ||
data.brightness = Math.floor(brightnessTotal / pixelCount); | ||
@@ -115,3 +117,3 @@ triggerDataUpdate(); | ||
var hiddenImage = new Image(); | ||
hiddenImage.setAttribute("crossOrigin", "crossOrigin"); | ||
hiddenImage.setAttribute("crossOrigin", "crossOrigin"); | ||
@@ -137,2 +139,7 @@ hiddenImage.onload = function() { | ||
hiddenImage.src = fileData; | ||
} else if (typeof fileData.data !== 'undefined' | ||
&& typeof fileData.width === 'number' | ||
&& typeof fileData.height === 'number') { | ||
images.push(fileData); | ||
callback(fileData, fileData.width, fileData.height); | ||
} else { | ||
@@ -356,3 +363,3 @@ fileReader = new FileReader(); | ||
if( (width > 1200 || height > 1200) && ignoreAntialiasing){ | ||
if(!!largeImageThreshold && ignoreAntialiasing && (width > largeImageThreshold || height > largeImageThreshold)){ | ||
skip = 6; | ||
@@ -602,5 +609,9 @@ } | ||
} | ||
pixelTransparency = options.transparency || pixelTransparency; | ||
if (options.largeImageThreshold !== undefined) { | ||
largeImageThreshold = options.largeImageThreshold; | ||
} | ||
return this; | ||
@@ -607,0 +618,0 @@ }; |
17609
478
79