How to watermark animated GIFs & combine 2 commands together

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?".
Post Reply
tk123
Posts: 1
Joined: 2012-08-23T14:57:34-07:00
Authentication code: 67789

How to watermark animated GIFs & combine 2 commands together

Post by tk123 »

I am on a Windows 7 machine using imagemagick from the command line.

The following code works to add watermarks to images:

Code: Select all

composite -watermark 30% -gravity south the_watermark.png pic_to_be_watermaked.png watermark_completed.png
Problems are:

- It doesn't work when I try to watermark an animated GIF
- How to use this watermark command in conjunction with the command below?

This command takes all the PNGs inside the folder "static_images" and combines them into an animated GIF. It also makes sure that the image is 350px in width and the height is kept to the proper aspect ratio. It also gives the image some fuzz and sets the speed of the animation to 4 and makes sure it loops infinitely:

Code: Select all

convert -resize 350x350 -fuzz 1.6% -delay 4 -loop 0 static_images/*.png -layers OptimizePlus -layers OptimizeTransparency animated_gif.gif
Questions:
---------------

1. How can I combine the watermark command with the one above?
2. How can I get the watermark commmand to work with animated GIFs?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to watermark animated GIFs & combine 2 commands toge

Post by fmw42 »

1. How can I combine the watermark command with the one above?
2. How can I get the watermark commmand to work with animated GIFs?
Composite is very old and not very flexible.

1) Use convert ... -compose modulate rather than composite -watermark. see http://www.imagemagick.org/Usage/compose/#watermark

2) See animation examples at http://www.imagemagick.org/Usage/compose/#watermark. You probably have to -coalesce the animation and then composite the watermark onto all the frames using convert ... -compose modulate -composite, then write them all again to a gif format.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to watermark animated GIFs & combine 2 commands toge

Post by anthony »

See Animation Modiciations, Layer Composition
http://www.imagemagick.org/Usage/anim_mods/#composite

If one of the two lists is a single image, it is composed against the whole list of the other images.
See Single image compostion
http://www.imagemagick.org/Usage/anim_m ... ite_single

Use it with the normal single frame compostion tecniques, Watermarking with Images
http://www.imagemagick.org/Usage/annota ... mark_image
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply