Search code examples
phpanimationimagick

PHP Imagick create GIF animation


I have some JPEG files and I want to create a GIF animation with them. However this code doesn't work. Can you see what the problem is?

// animation
$animation = new Imagick();
$animation->setFormat("GIF");

// frames
foreach($tmpJpegPath as $jpepPath) {
    $frame = new Imagick($jpepPath);
    $frame->thumbnailImage(176, 144);
    $animation->addImage($frame);
    $animation->setImageDelay(100);
    $animation->nextImage();
}

// save gif animation
$animation->writeImages('./animation.gif', true);

Solution

  • problem solved ... imagick must be >= 3.1.0RC1