Add watermark on gif animation

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".

Add watermark on gif animation

Postby userman » 2010-09-15T05:48:39+00:00

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.
userman
 
Posts: 12
Joined: 2010-09-12T10:58:46+00:00

Re: Add watermark on gif animation

Postby Bonzo » 2010-09-15T09:29:36+00:00

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.
Bonzo
 
Posts: 2202
Joined: 2006-05-20T08:08:19+00:00
Location: Cambridge, England

Re: Add watermark on gif animation

Postby userman » 2010-09-15T12:56:45+00:00

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?
userman
 
Posts: 12
Joined: 2010-09-12T10:58:46+00:00

Re: Add watermark on gif animation

Postby anthony » 2010-09-15T17:26:57+00:00

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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8729
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: Add watermark on gif animation

Postby userman » 2010-09-15T23:32:30+00:00

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.
userman
 
Posts: 12
Joined: 2010-09-12T10:58:46+00:00

Re: Add watermark on gif animation

Postby anthony » 2010-09-16T00:20:35+00:00

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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8729
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: Add watermark on gif animation

Postby Bonzo » 2010-09-16T12:37:09+00:00

Thanks for the warning Anthony; I must have just been lucky with the original file format as you said!
Bonzo
 
Posts: 2202
Joined: 2006-05-20T08:08:19+00:00
Location: Cambridge, England


Return to Users

Who is online

Users browsing this forum: Google Adsense [Bot] and 27 guests