The delay can be set individually for each frame in an image.
Modify an animated Gif so that it's frames are played at a variable speed, varying between being shown for 50milliseconds down to 0ms, which will cause the frame to be skipped in most browsers.
Image
The delay can be set individually for each frame in an image.
Modify an animated Gif so that it's frames are played at a variable speed, varying between being shown for 50milliseconds down to 0ms, which will cause the frame to be skipped in most browsers.
Parameters
delayintThe amount of time expressed in 'ticks' that the image should be displayed for. For animated GIFs there are 100 ticks per second, so a value of 20 would be 20/100 of a second aka 1/5th of a second.
function setImageDelay()
{
    $imagick = new \Imagick(realpath("images/coolGif.gif"));

    $frameCount = 0;

    foreach ($imagick as $frame) {
        /** @var $frame \Imagick */
        $frame->setImageDelay((($frameCount % 11) * 5));
        $frameCount++;
    }

    $imagick2 = $imagick->deconstructImages();

    header("Content-Type: image/gif");
    echo $imagick2->getImagesBlob();
}