views:

136

answers:

1

I intent to resize an animated gif and outputing it to the browser on-the-fly. My problem is that when I save the resized image it is of good quality, but if I echo it to the browser it is of poor quality and the animation is removed. Here is the code:`

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(); } `

A: 

try it with

echo $animation->getImagesBlob();
somename