[SOLVED] How to add animated watermark (GIF) on a static image (GIF)?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
pigeon33
Posts: 9
Joined: 2015-11-15T00:15:37-07:00
Authentication code: 1151

[SOLVED] How to add animated watermark (GIF) on a static image (GIF)?

Post by pigeon33 »

Hello,

I will try to keep it short ))

My goal is to find a command line to add an animated watermak (GIF) on a static image (GIF)

My version of ImageMagick:

convert -version
Version: ImageMagick 6.9.2-5 Q16 x64 2015-10-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180031101
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

My platform is Windows.

The command line that I tried: http://www.xoogu.com/2013/how-to-automa ... agemagick/

The problem with this command line is even if you use an animated GIF as watermark the final result is not animated.

Could you please tell me what is the command line that can fit my needs?

Thank you...

M.
Last edited by pigeon33 on 2015-11-15T08:47:21-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to add animated watermark (GIF) on a static image (GIF)?

Post by fmw42 »

pigeon33
Posts: 9
Joined: 2015-11-15T00:15:37-07:00
Authentication code: 1151

Re: How to add animated watermark (GIF) on a static image (GIF)?

Post by pigeon33 »

Thank you because it is exactly what I need BUT when I copy/paste the command line in my cmd it don't works because it is (I guess) a multi line command. Is it possible to convert this command in a 1 line command only?

debug:

F:\>convert -size 100x100 plasma:fractal null: \( script_k.gif -coalesce \) \
convert.exe: unable to open image `\(': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert.exe: unable to open image `\)': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.

F:\> -gravity Center -layers Composite \
'-gravity' is not recognized as an internal or external command,
operable program or batch file.

F:\> -layers Optimize composite_background.gif
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to add animated watermark (GIF) on a static image (GIF)?

Post by snibgo »

Examples on those pages are Unix bash. Bash syntax is different to Windows syntax. See http://www.imagemagick.org/Usage/windows/
snibgo's IM pages: im.snibgo.com
pigeon33
Posts: 9
Joined: 2015-11-15T00:15:37-07:00
Authentication code: 1151

Re: How to add animated watermark (GIF) on a static image (GIF)?

Post by pigeon33 »

Thank you because now it works on my Windows however why I always see the "plasma:fractal" image? My goal is to be able to add the "script_k.gif" (animated GIF) to any kind of GIF not only to "plasma:fractal". Could you please tell me what I have to modify?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to add animated watermark (GIF) on a static image (GIF)?

Post by snibgo »

Instead of "plasma:fractal", put the filename of the image you want.
snibgo's IM pages: im.snibgo.com
pigeon33
Posts: 9
Joined: 2015-11-15T00:15:37-07:00
Authentication code: 1151

Re: How to add animated watermark (GIF) on a static image (GIF)?

Post by pigeon33 »

Thank you Snibgo it works perfectly!

In case someone else need it... This is the command line I use on Windows:

convert -size 100x100 "F:\composite_background.gif" null: ( "F:\script_k.gif" -coalesce ) ^
-gravity Center -layers Composite ^
-layers Optimize "F:\test.gif"
pigeon33
Posts: 9
Joined: 2015-11-15T00:15:37-07:00
Authentication code: 1151

Re: [SOLVED] How to add animated watermark (GIF) on a static image (GIF)?

Post by pigeon33 »

Last quick question... for the watermark I use a GIF with transparent background but when I apply this watermark on my image the background is still transparent but it is not very clean... do you know why? Thank you!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [SOLVED] How to add animated watermark (GIF) on a static image (GIF)?

Post by snibgo »

pigeon33 wrote:... do you know why?
Not without seeing the images. Don't forget that GIF is limited to 256 colours. If both the inputs have 256 colours each, then many pixels will change colour.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [SOLVED] How to add animated watermark (GIF) on a static image (GIF)?

Post by fmw42 »

GIF transparency is also binary (on or off) as opposed to 8-bit transparency in formats such as PNG8:. So the edges may be jagged.

Snibgo also pointed out about the color limitation. So it might be a good idea to remap each frame to a common color map. See http://www.imagemagick.org/Usage/quantize/#remap
Post Reply