Node.js GM edge() Function
Last Updated :
31 Mar, 2023
The edge() function is an inbuilt function in the GraphicsMagick library which is used to detect edges within an image. The function returns the true value on success.
Syntax:
edge( radius )
Parameters: This function accepts a single parameter as mentioned above and described below:
- radius: This parameter is used to specify the radius of the edges within the image.
Return Value: This function returns the GraphicsMagick object.
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.borderColor( 'Green' )
.border(10, 30)
.edge(13)
.write( "edge1.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)
.drawText(100, 280, "GeeksforGeeks!" )
.borderColor( "Green" )
.border(62, 32)
.edge(20)
.write( "edge2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Share your thoughts in the comments
Please Login to comment...