2012-08-28 53 views
0

這工作正常無動畫圖像:爲GIF動畫添加水印與PHP ImageMagick庫

$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動畫? 它只是把每一幀放在彼此的下面,而水印在下面。

回答

0

請參見下面的網址我非常肯定這是非常有助於全給你: -

Watermark on animated gif with php

試試這個

$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

+0

另請參閱http://www.imagemagick.org/Usage/anim_mods/#composite http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=21730 –

+0

我該怎麼做與PHP API? – Tyilo