To crop an image using HTML5 Canvas, we can add six additional arguments to the drawImage() method, sourceX, sourceY, sourceWidth, sourceHeight, destWidth and destHeight. These arguments define the location and size of a rectangle that we want to cut out of an image.

Reference: www.whatwg.org
Code Editor
Modified on April 8th, 2013
by Eric Rowell