Node.js GM gamma() Function
Last Updated :
30 Mar, 2023
The gamma() function is an inbuilt function in the GraphicsMagick library which is used to level of gamma correction. The function returns the true value on success.
Syntax:
gamma(red, green, blue)
Parameters: This function accepts three parameters as red, green, and blue which correct the gamma level of red, green, and blue colors respectively.
Return Value: This function returns the GraphicsMagick object.
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.gamma(1, 3.4, 6)
.write "gamma1.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)
.gamma(3, 45, 10)
.write( "gamma2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Share your thoughts in the comments
Please Login to comment...