Skip to content

Commit

Permalink
Added width and height dimensions to the drawImage method to preserve…
Browse files Browse the repository at this point in the history
… the size of the image if the <img> element contains width and height attributes.
  • Loading branch information
Cory Dorning committed Oct 13, 2011
1 parent 8449906 commit 0bed9eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jquery-inverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
canvas.setAttribute('width', img.width);

var context = canvas.getContext('2d');
context.drawImage(img, 0, 0);
context.drawImage(img, 0, 0, img.width, img.height);

var imgData = context.getImageData(0, 0, canvas.width, canvas.height),
data = imgData.data;
Expand Down

0 comments on commit 0bed9eb

Please sign in to comment.