title: How to proportionally resize an image in canvas?
body: <p>AFAIK, to resize a loaded image in HTML5 canvas would be done like this:</p>
  
  <pre><code>var img = new Image();
  img.onload = function () {
    ctx.drawImage(img, 0, 0, 300, 200); // resizes image to 300px wide, 200px high
  }
  img.src = 'images/myimage.jpg';
  </code></pre>
  
  <p>But then I realised that the image wouldn't be proportionally correct. So then I tried using one parameter only (just like in HTML) but I found that didn't work either.</p>
  
  <p>How do I proportionally resize the image?</p>