Canvas

Canvas Tutorials

Canvas Methods and Properties

HTML canvas drawImage() Method

HTML canvas drawImage() Method

 

 

The drawImage() method is used to draw an image, canvas onto the canvas. It can also be used to resize the image and also draw parts of an image.

 

Syntax:-

 

Its syntax is:- context.drawImage(img, sx, sy, swidth, sheight, x, y, width, height);

 

Further Explanation:-

 

Parameter Description
img Specifies the image, canvas, or video element to use
sx Optional. The x-coordinate where to start clipping
sy Optional. The y-coordinate where to start clipping
swidth Optional. The width of the clipped image
sheight Optional. The height of the clipped image
x The x-coordinate is where to place the image on the canvas
y The y-coordinate is where to place the image on the canvas
width Optional. The width of the image to use.
height Optional. The height of the image to use.

Code Explanation

All Tutorials related to Canvas Methods and Properties

All Sections related to Canvas