title: Canvas drawImage() not working
body: <p>This Javascript code draw part of the image on the canvas:</p>
  
  <pre><code>var img = document.getElementById('img');
  var canvas = document.getElementById('can');
  //canvas.width = img.width;
  //canvas.height = img.height;
  var ctx = canvas.getContext("2d");
  ctx.drawImage(img, 0, 0);
  </code></pre>
  
  <p>But when I uncomment the middle lines to set the canvas width and height, the drawImage() does not work.
  What should I check in order to find the problem?</p>