【问题标题】:Outputing resized animated gif to browser using imagick使用imagick将调整大小的动画gif输出到浏览器
【发布时间】:2011-03-02 23:53:02
【问题描述】:

我打算调整动画 gif 的大小并将其即时输出到浏览器。我的问题是,当我保存调整大小的图像时,它的质量很好,但如果我将其echo 发送到浏览器,它的质量很差并且动画被删除。代码如下:

header("Content-type:image/gif");
try
{
    /*** Read in the animated gif ***/
    $animation = new Imagick("images/nikks.gif");

    /*** Loop through the frames ***/
    foreach ($animation as $frame)
    {
        /*** Thumbnail each frame ***/
        $frame->thumbnailImage(200, 200);

        /*** Set virtual canvas size to 100x100 ***/
        $frame->setImagePage(200, 200, 0, 0);
    }

    /*** Write image to disk. Notice writeImages instead of writeImage ***/
    //$animation->writeImages("images/nikkyo1.gif",true);

    echo $animation;
}
catch(Exception $e)
{
    echo $e->getMessage();
}

【问题讨论】:

    标签: php imagemagick gif imagick


    【解决方案1】:

    尝试一下

    echo $animation->getImagesBlob();
    

    【讨论】:

      猜你喜欢
      • 2015-06-16
      • 2013-06-11
      • 2011-08-09
      • 2011-08-31
      • 1970-01-01
      • 2018-04-18
      • 2020-03-17
      • 2012-09-07
      • 2011-06-10
      相关资源
      最近更新 更多