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?".
userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Add watermark on gif animation

Postby userman » 2010-09-15T05:48:39-07: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.

Bonzo
Posts: 2277
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Contact:

Re: Add watermark on gif animation

Postby Bonzo » 2010-09-15T09:29:36-07: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.

userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Re: Add watermark on gif animation

Postby userman » 2010-09-15T12:56:45-07: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?

User avatar
anthony
Posts: 8736
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia
Contact:

Re: Add watermark on gif animation

Postby anthony » 2010-09-15T17:26:57-07: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/

userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Re: Add watermark on gif animation

Postby userman » 2010-09-15T23:32:30-07: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.

User avatar
anthony
Posts: 8736
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia
Contact:

Re: Add watermark on gif animation

Postby anthony » 2010-09-16T00:20:35-07: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/

Bonzo
Posts: 2277
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Contact:

Re: Add watermark on gif animation

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

Thanks for the warning Anthony; I must have just been lucky with the original file format as you said!


Return to “Users”

Who is online

Users browsing this forum: Bing [Bot], TurnitinBot [Bot] and 5 guests