Browse Source

Merge branch 'JonWallsten-master'

pull/96/head
james.cryer 8 years ago
parent
commit
16357ecb0b
  1. 19
      resemble.js

19
resemble.js

@ -174,16 +174,18 @@ URL: https://github.com/Huddle/Resemble.js
var hiddenCanvas = document.createElement('canvas');
var imageData;
if( scaleToSameSize && images.length == 1 ){
hiddenImage.width = images[0].width;
hiddenImage.height = images[0].height;
}
// don't assign to hiddenImage, see https://github.com/Huddle/Resemble.js/pull/87/commits/300d43352a2845aad289b254bfbdc7cd6a37e2d7
var width = hiddenImage.width;
var height = hiddenImage.height;
if( scaleToSameSize && images.length == 1 ){
width = images[0].width;
height = images[0].height;
}
hiddenCanvas.width = width;
hiddenCanvas.height = height;
hiddenCanvas.getContext('2d').drawImage(hiddenImage, 0, 0, width, height);
imageData = hiddenCanvas.getContext('2d').getImageData(0, 0, width, height);
@ -200,8 +202,11 @@ URL: https://github.com/Huddle/Resemble.js
} else if (typeof fileData.data !== 'undefined'
&& typeof fileData.width === 'number'
&& typeof fileData.height === 'number') {
images.push(fileData);
callback(fileData, fileData.width, fileData.height);
} else {
fileReader = new FileReader();
fileReader.onload = function (event) {
@ -231,10 +236,6 @@ URL: https://github.com/Huddle/Resemble.js
}
}
function isNumber(n) {
return !isNaN(parseFloat(n));
}
function isPixelBrightnessSimilar(d1, d2){
var alpha = isColorSimilar(d1.a, d2.a, 'alpha');
var brightness = isColorSimilar(d1.brightness, d2.brightness, 'minBrightness');

Loading…
Cancel
Save