Node.js GM gaussian() Function
The gaussian() function is an inbuilt function in the GraphicsMagick library which is used to blur the image by the gaussian operator. It uses the radius and the standard deviation value known as sigma. The function returns the true value on success.
Syntax:
gaussian(radius, sigma)
Parameters: This function accepts two parameters as mentioned above and described below:
- radius: It holds the radius by which the radius of the image should be blurred.
- sigma: The holds the standard deviation (sigma) by which the images should be blurred.
Return Value: This function returns the GraphicsMagick object.
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.gaussian(12, 3)
.write("gaussian1.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)
.gaussian(8, 6)
.write("gaussian2.png", function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Last Updated :
31 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...