Node.js GM drawCircle() Function
Last Updated :
30 Mar, 2023
The drawCircle() function is an inbuilt function in the GraphicsMagick library which is used to draw Circles with specified coordinates. The function returns the true value of success.
Syntax:
drawCircle( x0, y0, x1, y1 )
Parameters: This function accepts four parameters as mentioned above and described below:.
- x0: This parameter stores the x-coordinate value of the initial point.
- y0: This parameter stores the y-coordinate value of the initial point.
- x1: This parameter stores the x-coordinate value of the final point.
- y1: This parameter stores the y-coordinate value of the final point.
Return Value: This function returns the GraphicsMagick object.
Original Image:
Example 1:
javascript
const gm = require( 'gm' ).subClass({imageMagick: true });
gm( '1.png' )
.stroke( "#ffffff" )
.drawCircle(30, 45, 300, 89)
.write( "drawCircle1.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Example 2:
javascript
const gm = require( 'gm' );
gm(600, 300, 'white' )
.stroke( "green" , 3)
.font( "Helvetica.ttf" , 60)
.drawCircle(10, 145, 200, 199)
.drawText(100, 280, "GeeksforGeeks!" )
.write( "drawCircle1.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...