Page 1 of 1

Add watermark on gif animation

Posted: 2010-09-15T05:48:39-07:00
by userman
Hi,

I use in my script for add the watermark this:

#Adding watermark
exec('composite -gravity SouthEast images/logo-watermark.png '.$imagesurse2.' '.$imagesurse2);

but this dont work with gif animation :(


what i must add or change for work with gif animation?

Regards.

Re: Add watermark on gif animation

Posted: 2010-09-15T09:29:36-07:00
by Bonzo
Image
I have only tried this once and used:

Code: Select all

<?php
$animation = "morph.gif";

$watermark = "output.png";

$watermarked_animation = "morph.gif";

exec("convert -resize 100x200 $animation -coalesce -gravity South  -geometry +0+0 null: $watermark -layers composite -layers optimize $watermarked_animation ");
?> 

This is resizing the gif as well - just leave out the resize part.
The gif only loops once if you refresh the page it should loop again.

Re: Add watermark on gif animation

Posted: 2010-09-15T12:56:45-07:00
by userman
Thanks bonzo!!

I use it for the png and gif, this work good but when the file is created, the file have bad quality, why?

Re: Add watermark on gif animation

Posted: 2010-09-15T17:26:57-07:00
by anthony
WARNING:
read and coalesce the animation BEFORE using -resize.

See IM examples, Animation Modifications, Resize
http://www.imagemagick.org/Usage/anim_mods/#resize

If you don't and your animation has any form of optimization such as 'frame' or 'transparency', then it will go screwy!!! It only worked in your case as your 'morphed' animation is already a coalesced animation.

See Animation Types. Also look at Animation Optimizations, to get an idea of what these optimizations are

Re: Add watermark on gif animation

Posted: 2010-09-15T23:32:30-07:00
by userman
Thanks Anthony,

I use:
exec("convert $imagesurse2 -coalesce -gravity SouthEast -geometry +0+0 null: images/logo-watermark.png -layers composite -layers optimize $imagesurse2 ");

but i use this code for gif animation and for NO gif animations too, because i have this code the last file that generate all the images...

how can i change the code for get good quality for the files gif and not gif...

Thanks for the help!! this forum is great!!

Regards.

Re: Add watermark on gif animation

Posted: 2010-09-16T00:20:35-07:00
by anthony
The actions for GIF animations should not effect a single GIF file, unless you specifically
modify GIF animation attributes, such as -loop or -delay

You should be able to use the same command no problem.

Re: Add watermark on gif animation

Posted: 2010-09-16T12:37:09-07:00
by Bonzo
Thanks for the warning Anthony; I must have just been lucky with the original file format as you said!