Nodejs | GM solarize() Function
The solarize() function is an inbuilt function in the GraphicsMagick library which is used to negate all pixels above the threshold level. The function returns the true value of success.
Syntax:
solarize(thresholdLevel)
Parameters: This function accepts a single parameter thresholdlevel which is used to specify the threshold level between 0 to 100.
Return Value: This function returns the GraphicsMagick object.
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.solarize(12)
.write( "solarize1.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)
.solarize(3)
.write( "solarize2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Last Updated :
03 Apr, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...