dqpfkzu360216 2012-06-23 13:09
浏览 35
已采纳

使用Gmagick创建GIF动画

I have some jpg files i want to create gif animated from them. i cant find useful method in gmagick for this problem. any one know about it?

I need simple example for it. ty

  • 写回答

3条回答 默认 最新

  • dongyang9813 2012-06-23 14:24
    关注

    Gmagick example on how to create a GIF picture from two PNG files:

    $first = new Gmagick("example.0.png");
    $first->setImageformat("gif");
    $first->setImageDelay(100);
    $second = new Gmagick ("example.1.png");
    $first->nextImage();
    $first->addImage($second);
    $first->previousImage();
    $first->write('example.gif');
    

    Example taken from https://bugs.php.net/bug.php?id=59420

    Take care that Gmagick internally keeps track at which image you are, that is why nextImage­Docs is used before adding the second image and why previousImage­Docs is used before writing it to disk.

    Start with this two picture example and then change it to a version that adds pictures from an array and with three pictures. And then finally read the array from a directory from 0 to N pictures (e.g. with glob). Have fun!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?