<canvas id="Canvas1" width="100" height="100"></canvas>
drawImage() method: This method can be used to draw an image or video on the web page. It can also be used to draw parts of an image. Another useful function is to increase or decrease the size of the image.
Cropping an image using drawImage() method: In order to crop a source image to its destination image. the following parameters of drawImage() need to be specified.
- image: The image to be cropped.
- sourceX: The x-coordinate of the source image
- sourceY: The y-coordinate of the source image.
- sourceW: The width of the source image.
- sourceH: The height of the source image.
- destinationX: The x-coordinate of the destination image.
- destinationY: The y-coordinate of the destination image.
- destinationW: The width of the destination image.
- destinationH: The height of the destination image.
drawImage(image, sourceX, sourceY, sourceW, sourceH, destinationX,destinationY, destinationW, destinationH)
- Node Jimp | Crop
- Nodejs | GM crop() Function
- How to create a canvas image using Fabric.js ?
- How to resize an image in an HTML 5 canvas ?
- How to save an HTML 5 Canvas as an image on the server ?
- Convert an image into grayscale image using HTML/CSS
- How to change the font of HTML5 Canvas using a button in Angular.js?
- How to remove borders of a canvas-type text using Fabric.js ?
- How to add shadow to a canvas circle using Fabric.js ?
- How to clear the canvas using clearRect in HTML ?
- How to specify the width and height of the canvas using HTML ?
- How to create a simple editable canvas textbox using Fabric.js?
- How to create a canvas circle using Fabric.js ?
- How to create a canvas ellipse using Fabric.js ?
- How to create a canvas polygon using Fabric.js ?
- How to rotate a text canvas using Fabric.js ?
- How to create a rectangle canvas using Fabric.js ?
- How to create a polyline canvas using Fabric.js ?
- How to change font-family of a text canvas using Fabric.js ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.