PHP imagick gif 调整所有帧的大小


php imagick gif resize all frame

我有一个问题,使用 PHP imagick 调整所有帧的大小。 它取自官方 PHP 文档示例 http://ir.php.net/manual/en/imagick.examples-1.php

/* Create a new imagick object and read in GIF */
$im = new Imagick("/tmp/bbb.gif");
/* Resize all frames */
foreach ($im as $frame) {
    /* 50x50 frames */
    $frame->thumbnailImage(50, 50);
    /* Set the virtual canvas to correct size */
    $frame->setImagePage(50, 50, 0, 0);
}
/* Notice writeImages instead of writeImage */
$im->writeImages("/tmp/zb.gif", true);

试试这个页面上的例子:http://www.php.net/manual/en/imagick.coalesceimages.php

根据 gif 的创建方式,您可能需要 Coalesce;也不是关于版本问题的 coment。