I search for a long time how to extract frames from an animated GIF with PHP... unfortunaly I just found how to get their duration...
I really need to extract the GI
I am the author of https://github.com/stil/gif-endec library, which is significantly faster (about 2.5 times) at decoding GIFs than Sybio/GifFrameExtractor library from accepted answer. It has also less memory usage, because it allows you to process one frame after another at decode time, without loading everything to memory at once.
Small code example:
decode(function (FrameDecodedEvent $event) {
/**
* Write frame images to directory
*/
$event->decodedFrame->getStream()->copyContentsToFile(
__DIR__ . "/frames/frame{$event->frameIndex}.gif"
);
});