1

アニメーション 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();
}
4

1 に答える 1

2

で試してみてください

echo $animation->getImagesBlob();
于 2010-09-20T15:06:40.620 に答える