Node.js GM modulate() Function
Last Updated :
29 Mar, 2023
The modulate() function is an inbuilt function in the GraphicsMagick library which is used to vary the brightness, saturation, and hue of an image. The function returns the true value of success.
Syntax:
modulate( brightness, saturation, hue )
Parameters: This function accepts three parameters as mentioned above and described below:
- Brightness: This parameter is used to specify the value of the brightness level.
- Saturation: This parameter is used to specify the value of the saturation level.
- Hue: This parameter is used to specify the value of the hue level.
Return Value: This function returns the GraphicsMagick object.
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.borderColor( 'Green' )
.border(10, 30)
.modulate(50, 50, 50)
.write( "modulate1.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)
.modulate(120, 110, 130)
.write( "modulate2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...