0

How to get gif frames using node gm?

Example on PHP

$frames = new \Imagick( 'image.gif' )->coalesceImages();

https://github.com/aheckmann/gm

1 Answers1

0

https://github.com/aheckmann/gm/issues/512

gm("./image.gif").identify(function (err, val) {
    let frames_count = val.Scene.replace(/\d* of /, "");

    for(let i = 0; i < frames_count; i++) {
        let path = `./frame${i}.png`;
        this.selectFrame(i).write(path, function () {
            console.log(arguments[3]);
        });
    }
});