Permalink
Browse files

Set canvas width and height before adding image.

According to the w3c specs for the canvas element, it defaults to a
width of 300px and height of 150 px. This causes any image which excedes
these limits to return black pxiels for those regions outside of this
boundary.

http://www.w3.org/TR/2012/WD-html5-author-20120329/the-canvas-element.html#the-canvas-element
  • Loading branch information...
5thWall committed Feb 15, 2013
1 parent 71e09e8 commit ef63515efa9ab8c06dc9582bcc09c6626ebee2f8
Showing with 2 additions and 0 deletions.
  1. +2 −0 albumcolors.js
View
@@ -104,6 +104,8 @@
var canvas, context;
canvas = document.createElement('canvas');
+ canvas.width = this.image.width;
+ canvas.height = this.image.height;
context = canvas.getContext('2d');
context.drawImage(this.image, 0, 0);

0 comments on commit ef63515

Please sign in to comment.