From 300d43352a2845aad289b254bfbdc7cd6a37e2d7 Mon Sep 17 00:00:00 2001 From: Jon Wallsten Date: Thu, 24 Nov 2016 14:41:22 +0100 Subject: [PATCH 1/2] Fixed issue where scaleToSameSize is not working when using node-canvas. Can't set image dimensions. --- resemble.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/resemble.js b/resemble.js index 67f6eda..4103590 100644 --- a/resemble.js +++ b/resemble.js @@ -174,16 +174,16 @@ 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; - } - var width = hiddenImage.width; - var height = hiddenImage.height; + var height = hiddenImage.height; + + if( scaleToSameSize && images.length == 1 ){ + width = images[0].width; + height = images[0].height; + } - hiddenCanvas.width = width; - hiddenCanvas.height = 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); From 1ef9a2be4d8fd35b1fac1472decb2bdfedc33686 Mon Sep 17 00:00:00 2001 From: Jon Wallsten Date: Thu, 24 Nov 2016 14:47:17 +0100 Subject: [PATCH 2/2] What sane person uses tabs? --- resemble.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resemble.js b/resemble.js index 4103590..5514235 100644 --- a/resemble.js +++ b/resemble.js @@ -175,15 +175,15 @@ URL: https://github.com/Huddle/Resemble.js var imageData; var width = hiddenImage.width; - var height = hiddenImage.height; + var height = hiddenImage.height; - if( scaleToSameSize && images.length == 1 ){ - width = images[0].width; - height = images[0].height; - } + if( scaleToSameSize && images.length == 1 ){ + width = images[0].width; + height = images[0].height; + } - hiddenCanvas.width = width; - hiddenCanvas.height = 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);