Node.js GM wave() Function
Last Updated :
30 Mar, 2023
The wave() function is an inbuilt function in the GraphicsMagick library which is used to alter an image along with a sine wave. The function returns the true value of success.
Syntax:
wave( amplitude, wavelength )
Parameters: This function accepts two parameters as mentioned above and described below:
- amplitude: This parameter stores the value of the amplitude of the sine wave.
- wavelength: This parameter stores the value of the wavelength of the sine wave.
Return Value: This function returns the GraphicsMagick object with an image added.
Original Image:
Example 1:
javascript
const gm = require( 'gm' );
gm( 'gfg.png' )
.wave(10, 3)
.write( "wave1.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Example 2:
javascript
const gm = require( 'gm' );
gm( 'gfg.png' )
.stroke( "#fe1232" )
.fill( "#1200ff" )
.drawRectangle(10, 2, 130, 30, 1, 2)
.wave(20, 30)
.write( "wave2.png" , function (err) {
if (!err) console.log( 'done' );
});
|
Output:
Reference:
Share your thoughts in the comments
Please Login to comment...