Skip to content
Related Articles

Related Articles

Nodejs | GM paint() Function
  • Last Updated : 16 Mar, 2020

The paint() function is an inbuilt function in the GraphicsMagick library which is used to simulate an oil painting.
The function returns the true value on success.

Syntax:

paint( radius )

Parameters: This function accepts single parameter as mentioned above and described below:

  • radius: This parameter is used to specify the radius of the paint.

Return Value: This function returns the GraphicsMagick object.

Example 1:






// Include gm library
var gm = require('gm');
  
// Import the image
gm('1.png')
  
// Invoke ordered Dither on
// Green Channel with 50 x 60
.paint(2)
  
// Process and Write the image
.write("paint1.png", function (err) {
  if (!err) console.log('done');
});

Output:

Example 2:




// Include gm library
var gm = require('gm');
  
//Import the image
gm(600, 300, 'white')
  
// set the color for the stroke
.stroke("green", 3)
  
// Set the font 
.font("Helvetica.ttf", 60)
  
// Call to drawText Function
.drawText(100, 280, "GeeksforGeeks!")
  
// Invoke paint function
.paint(1.2)
  
// Process and write the image 
.write("paint2.png", function (err) {
  if (!err) console.log('done');
});

Output:

Reference:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :