I want to split input.gif
into the files output0.png
through output15.png
.
Works perfectly fine in the terminal when I use this:
convert -coalesce input.gif output%d.png
But now I need to automate this across hundreds of files in specific folders using gm
and I can not figure out how to make it work. You are supposed to use in() and out() to handle arguments, but it only ever outputs a single file named output%d.png
Can anyone with experience about gm help?
This is my current try:
gm("input.gif")
.in("-coalesce")
.out("output%d.png")
.stream("png", function (err, stdout, stderr) {
// console.log(stdout)
var writeStream = fs.createWriteStream("output%d.png");
stdout.pipe(writeStream);
});