Node.js GM blur() Function
The blur() function is an inbuilt function in the GraphicsMagick library which is used to add a blur filter to the image. The function returns the true value of success.
Syntax:
blur( radius, sigma )
Parameters: This function accepts two parameters as mentioned above and described below:
- radius: This parameter stores the value of the blur radius.
- sigma: It is an optional parameter that stores the sigma of the object.
Return Value: This function returns a blurred Gmagick image.
Original Image:
Example 1:
javascript
const gm = require( 'gm' );
gm( 'gfg.png' )
.blur(10)
.write( "blur1.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Example 2:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.rotate( "#545651" , 78)
.blur(5, 5)
.write( "blur2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Last Updated :
30 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...