Windows10系统下载,Win10激活,Win10教程

使用imagick在动态gif图片上打文字水印

http://www.zftb.cn  发布时间:2015-03-05 17:04 来源:未知 浏览:加载中

前几天有一个朋友找到我,说使用imagewand在生成的动态gif图片上打文字水印一直有问题。本想研究一下,但后来经过沟通imagick也可以,就答应他搞一个出来。

代码如下:

$imagedraw = new Imagick();
$pixel = new ImagickPixel('gray');
$pixel->setColor('black');
$imagedraw->newImage(100, 75, $pixel);
$draw = new ImagickDraw();
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize(12);
$image=new Imagick();
$animation = new Imagick();
$animation->setFormat( "gif" );
$image->readImage("old.gif");
$unitl = $image->getImageIndex();
$image->writeImages('animation.gif',false);
$delay = $image->getImageDelay();
$filename = 'animation-'; 
for ($i=0; $i<$unitl; $i++) {
    $thisimage = new Imagick();
    $thisimage->readImage($filename.$i.'.gif');
    $thisimage->annotateImage($draw, 0, 12, 0, 'copyright by mpeg');
    $animation->addImage($thisimage);
    $animation->setImageDelay($delay);
}        
header("Content-Type: image/gif");
echo $animation->getImagesBlob();
?>
 

如果你有好的win10资讯或者win10教程,以及win10相关的问题想要获得win10系统下载的关注与报道。
欢迎加入发送邮件到657025171#qq.com(#替换为@)。期待你的好消息!