The sharpen() function is an inbuilt function in 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 accept two parameters as mentioned above and described below:
- radius: This parameter stores the radius value of the sharpness.
- sd: It is an optional parameter which stores the standard deviation of the image.
Return Value: This function returns Gmagick sharpen image.
Original Image:

Example 1:
// Include gm library var gm = require('gm'); // Import the image gm('1.png') // Invoke sharpen function with // radius as 10 ad standard // deviation as 2 .sharpen(10, 2) // Process and Write the image .write("1b.png", function (err) { if (!err) console.log('done'); }); |
Output:

Example 2:
// Include gm library var gm = require('gm'); // Import the image gm('1.png') // Set stroke color .stroke("#fe1232") // Set fill color .fill("#1200ff") // Draw Rectangle using drawRectangle function .drawRectangle(10, 2, 130, 30, 1, 2) // Invoke Sharpen Function with radius as 10 .sharpen(10) // Process and Write the image .write("1a.png", function (err) { if (!err) console.log('done'); }); |
Output:

Reference:
Recommended Posts:
- Wand sharpen() function - Python
- Nodejs | Automatic restart NodeJs server with nodemon
- Nodejs | GM motionBlur() Function
- Nodejs | GM spread() Function
- Nodejs | GM solarize() Function
- Nodejs | GM shave() Function
- Nodejs | GM emboss() Function
- Nodejs | GM crop() Function
- Nodejs | GM despeckle() Function
- Nodejs | GM quality() Function
- Nodejs | GM drawCircle() Function
- Nodejs | GM drawEllipse() Function
- Nodejs | GM drawPolygon() Function
- Nodejs | GM drawBezier() Function
- Nodejs | GM drawLine() Function
- Nodejs | GM drawArc() Function
- Nodejs | GM drawPolyline() Function
- Nodejs | GM drawRectangle() Function
- Nodejs | GM charcoal() Function
- Nodejs | GM gamma() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.

