Seperating the individual images in an animated gif with PHP has never been easier than now with the Imagick extension. The Imagick extension allows a vast array of functionality with image manipulation. Here an animated gif is iterated over frame by frame and each frame is resized and thumbnailed. Note the use of writeImages() instead of writeImage(). A handy trick when needing to thumbnail an animated gif.


/*** Read in the animated gif ***/
$animation = new Imagick("animation.gif");

/*** Loop through the frames ***/
foreach ($animation as $frame)
/*** Thumbnail each frame ***/
/*** Set virtual canvas size to 100x100 ***/

/*** Write image to disk. Notice writeImages instead of writeImage ***/

"Images written";
Exception $e)