I'm trying to display an image in a canvas element. After computing the required width and height of the canvas, I'm calling the drawImage() method on the canvas context.
(c is the id of the canvas, ctx is the context)
$("#c").width(aw); $("#c").height(ah); ctx = canvas.getContext('2d'); alert(aw); ctx.drawImage(img1, 0, 0, aw, ah);
Even though the dimensions of both the canvas and the image are set to aw X ah, sometimes the image shown in the canvas is compressed vertically (the width of the image is approx. aw/2).
Any help would be appreciated.