Node.js GM shade() Function
Last Updated :
30 Mar, 2023
The shade() function is an inbuilt function in the GraphicsMagick library which is used to shade the image using a distant light source. The function returns the true value of success.
Syntax:
shade( azimuthal angle, elevation angle )
Parameters: This function accepts two parameters as mentioned above and described below:
- azimuthal angle: This parameter stores the value of the azimuthal angle.
- elevation angle: This parameter stores the value of the elevation angle.
Return Value: This function returns the GraphicsMagick object with an image added.
Original Image:
Example:
javascript
const gm = require( 'gm' );
gm( 'gfg.png' )
.stroke( "#fe1232" )
.fill( "#1200ff" )
.drawRectangle(10, 2, 130, 30, 1, 2)
.shade(45, 90)
.write( "shade1.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...