Sergey Pererva
Sergey Pererva

Reputation: 1

How to get gif frames using Node GraphicsMagick/ImageMagick

How to get gif frames using node gm?

Example on PHP

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

https://github.com/aheckmann/gm

Upvotes: 0

Views: 317

Answers (1)

Sergey Pererva
Sergey Pererva

Reputation: 1

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]);
        });
    }
});

Upvotes: 0

Related Questions