Reputation: 2613
I have an image with black background. I want to change it to have white background. Is that possible to achieve using GraphicsMagick in Nodejs?
I tried gm("test.png").fill("white")
but this didn't work for me.
I did some search and found there is a convert command but not sure there is equivalent function for it. gm.convert
ends up giving error.
Upvotes: 2
Views: 2045
Reputation: 5931
You are missing one step in your GraphicsMagick command, you do not specify which color you want to replace. You need to add opaque option to select the background color of your image:
gm('test.png')
.fill('white')
.opaque("black")
.write('out.png', function (err) {
if (err) console.log(err);
});
Note there are probably other ways to do it.
ImageMagick doc: Replace a Specific Color
Upvotes: 2
Reputation: 659
Find below link having all options for graphicsmagics
[link][1]
gm("img.png").highlightColor(color)
Upvotes: 1