0

这适用于非动画图像:

$image = new Imagick($file);

$format = strtolower($image->getImageFormat());

$watermark = new Imagick('watermark.png');
$watermark->scaleImage($image->getImageWidth(), $watermark->getImageHeight());

$image->addImage($watermark);

$image->resetIterator();
$combined = $image->appendImages(true);

$data = base64_encode($combined->getImageBlob());

echo '<img src="data:image/' . $format . ';base64,' . $data . '">';

我怎样才能使它适用于动画 GIF?它只是将每一帧放在彼此下方,并将水印放在下方。

4

1 回答 1

0

请参阅下面的 URL,我非常确定它对您很有帮助:-

使用php在动画gif上添加水印

尝试这个

$animation = ani.gif; 

$watermark = logo.png; 

$watermarked_animation = "morph.gif"; 

$cmd = " $animation -coalesce -gravity South ". 
" -geometry +0+0 null: $watermark -layers composite -layers optimize "; 

exec("convert $cmd $watermarked_animation "); 

也可以看看

http://www.imagemagick.org/Usage/anim_mods/#composite

http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=21730

于 2012-08-28T10:21:23.797 回答