Node.js GM charcoal() Function
Last Updated :
30 Mar, 2023
The charcoal() function is an inbuilt function in the GraphicsMagick library which is used to add a charcoal filter to the image. The function returns the true value of success.
Syntax:
charcoal( factor )
Parameters: This function accepts a single parameter which is mentioned above and described below:
- factor: This parameter stores the value of the charcoal factor which is to be applied to the image.
Return Value: This function returns the Gmagick charcoal image.
Original Image:
Example 1:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.charcoal(4)
.write( "charcoal1.png" , function (err) {
if (!err) console.log( 'done' );
})
|
Output:
Example 2:
javascript
const gm = require( 'gm' );
gm( '1.png' )
.stroke( "#fe1232" )
.fill( "#1200ff" )
/ Draw Rectangle using drawRectangle function
.drawRectangle(10, 2, 130, 30, 1, 2)
.charcoal(3)
.write( "charcoal2.png" , function (err) {
if (!err) console.log( 'done' );
})
|
Output:
Reference:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...