Add watermark to animated GIF with imageMagick (PHP) -
i need add watermark animated gif imagemagick .
have problem !
my code :
<?php $image = new imagick(); $image->readimage("orginal.gif"); $watermark = new imagick(); $watermark->readimage("watermark.png"); // how big images? $iwidth = $image->getimagewidth(); $iheight = $image->getimageheight(); $wwidth = $watermark->getimagewidth(); $wheight = $watermark->getimageheight(); if ($iheight < $wheight || $iwidth < $wwidth) { // resize watermark $watermark->scaleimage($iwidth, $iheight); // new size $wwidth = $watermark->getimagewidth(); $wheight = $watermark->getimageheight(); } // calculate position $x = ($iwidth - $wwidth) / 2; $y = ($iheight - $wheight) / 2; $image->compositeimage($watermark, imagick::composite_over, $x, $y); header("content-type: image/" . $image->getimageformat()); echo $image; ?>
original gif :
see original gif
output gif :
see output gif
my gif not animated after creating watermark !
how can fix ?
you have found code watermark image. animation need separate each frame, watermark , put together. check out: coalesce
Comments
Post a Comment