0

I have a png image and I want to change the color of that image using the GraphicsMagick node module. Does GraphicsMagick provide the functionality to change the color of an image?. Is there any other library through which I can change the color of an image.

Vikas
  • 1
  • 1

1 Answers1

0
var gm = require('../')
  , dir = __dirname + '/imgs'

gm(dir + "/original.jpg")
  .crop(140,100)
  .background("#FF0000")
  .extent(340,300)
  .write(dir + '/background.jpg', function (err) {
    if (err) return console.dir(arguments)
    console.log(this.outname + " created  ::  " + arguments[3])
});

See here some examples: https://github.com/aheckmann/gm/tree/master/examples

аlex
  • 5,426
  • 1
  • 29
  • 38
  • This doesn't _change_ the color of the image. It crops the image and adds a red colored background. – RobC May 23 '18 at 15:33
  • Yes, @RobC is right it just cropped the image and added the red color background. – Vikas May 23 '18 at 17:21