HTML5 Canvas Image Crop Tutorial

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.


new window

Code Editor

Modified on April 8th, 2013 by Eric Rowell
comments powered by Disqus