Friday, 5 May 2017

how to nest imagemagick commands in node.js gm library?

Using Imagemagick in node.js through the gm library (https://github.com/aheckmann/gm) I am able to flatten pictures, like this:

convert img1.png img2.png img3.png -flatten out.png

with this js code:

gm().command("convert").in("img1.png").in("img2.png").in("img3.png").in("-flatten").toBuffer('PNG' ...

but now I want to tint one of the images, like this:

convert img1.png \( img2.png -fill green -colorize 50% \) img3.png -flatten out.png

but I had not succeed, I tried:

.in("(img2.png -fill green -colorize 50% )")
.in("\(img2.png -fill green -colorize 50% \)")

what is the proper way to pass nested commands? thanks!



via cesarpachon

No comments:

Post a Comment