how to set the width and heigth of the canvas to be the same size as that of an image
function resizeCanvas()
{
var img = document.getElementById('dynamic_img');
var width = img.clientWidth;
var height = img.clientHeight;
var canvas = document.getElementById('canvas');
canvas.style.width = width;
canvas.style.height = height;
}