Node.js GM sharpen() Function
Last Updated :
30 Mar, 2023
The sharpen() function is an inbuilt function in the GraphicsMagick library which is used to sharpen the image. It uses a Gaussian operator of the given radius and standard deviation (sigma).
Syntax:
sharpen( radius, sd )
Parameters: This function accepts two parameters as mentioned above and described below:
- radius: This parameter stores the radius value of the sharpness.
- sd: It is an optional parameter that stores the standard deviation of the image.
Return Value: This function returns Gmagick to sharpen the image.
Original Image:
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.sharpen(10, 2)
.write( "1b.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)
.sharpen(10)
.write( "1a.png" , function (err) {
if (!err) console.log( 'done' );
})
|
Output:
Reference:
Share your thoughts in the comments
Please Login to comment...