본문
<?
/*** Read in the animated gif ***/
$animation = new Imagick("thumb-4016.f53e0a_30x25.gif");
$new_animation = new Imagick();
$new_animation->setFormat("gif");
/*** Loop through the frames ***/
$cnt=0;
foreach ($animation as $frame)
{
/*** Thumbnail each frame ***/
$frame->thumbnailImage(100, 100);
/*** Set virtual canvas size to 100x100 ***/
$frame->setImagePage(100, 100, 0, 0);
$frame_single = $frame->getImage();
//$frame_single->setImageDelay(10);
$new_animation->addImage($frame_single);
if ($cnt++>10) break;
}
$animation = $animation->deconstructImages();
$new_animation->writeImages('tmp_new.anim.gif', true);
/*** Write image to disk. Notice writeImages instead of writeImage ***/
$animation->writeImages("thumb-1.gif", true);
echo "Images written<BR>";
echo filesize("thumb-4016.f53e0a_30x25.gif"),"<BR>";;
echo filesize("thumb-1.gif"),"<BR>";;
echo filesize("tmp_new.anim.gif"),"<BR>";;
echo "<img src=thumb-4016.f53e0a_30x25.gif><BR>";
echo "<img src=thumb-1.gif><BR>";
echo "<img src=tmp_new.anim.gif><BR>";
?>
댓글목록
등록된 댓글이 없습니다.