Node.js GM swirl() Function
Last Updated :
30 Mar, 2023
The swirl() function is an inbuilt function in the GraphicsMagick library which is used around the center of the image. The degrees specify the tightness of the swirl.
Syntax:
swirl( angle )
Parameters: This function accepts a single parameter which is mentioned above and described below:
- angle: This parameter stores the angle of the swirl.
Return Value: This function returns the GraphicsMagick swirl image.
Original Image:
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.swirl(45)
.write( "swirl1.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Example 2:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.stroke( "#fe1232" )
.fill( "#1200ff" )
.drawRectangle(10, 2, 130, 30, 1, 2)
.swirl(-270)
.write( "swirl2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Share your thoughts in the comments
Please Login to comment...