context.drawImage(img,sx,sy,swidth,sheight,x,y,width,height); code example
Example: js canvas draw image
ctx.drawImage(image, x, y) // top left coords
ctx.drawImage(image, x, y, width, height) // scaled
ctx.drawImage(image, x, y) // top left coords
ctx.drawImage(image, x, y, width, height) // scaled