Two things:
You set a context size that doesn't make much sense. The canvas has a width and a height.
You really should use img_buffer.onload to make sure that you only draw the image when it is downloaded, and not before it is fully loaded.
Fiddle: http://jsfiddle.net/pimvdb/TpFQ8/
So:
<canvas id="paint_area" width="940" height="300"></canvas>
and
var cv = document.getElementById('paint_area'), ctx = ctx.getContext('2d');
and
img_buffer.onload = function() { var imgWidth = img_buffer.width; var imgHeight = img_buffer.height; cv.width = imgWidth; cv.height = imgHeight; ctx.drawImage(img_buffer, 0, 0, imgWidth, imgHeight); }
source share