From 7bf17dbcda92bf7833a856103e9e3e3fe046accd Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 28 Jul 2014 13:37:42 +0200 Subject: [PATCH] Included workaround for error 'Image given has not completed loading' of canvas-library. --- imagediff.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imagediff.js b/imagediff.js index d18eefb..5371a7c 100644 --- a/imagediff.js +++ b/imagediff.js @@ -117,7 +117,9 @@ canvas.width = width; canvas.height = height; context.clearRect(0, 0, width, height); - context.drawImage(image, 0, 0); + image.onload = function() { + context.drawImage(image, 0, 0); + } return context.getImageData(0, 0, width, height); } function toImageDataFromCanvas (canvas) {