Page 1 of 1

Watermarking an animated GIF with varied frame offsets and sizes

Posted: 2017-01-13T03:41:39-07:00
by coloring
I'm using ImageMagick 6.9.0-10 Q16 x64 2015-02-28 on Windows 8.1 via the command line.

I want to watermark multiple animated GIFs at once.
The GIFs canvas is always exactly 320px wide, but height wildly varies between 100px and 1200px. GIFs have varied frame sizes and varied offsets.
The watermark is huge and needs to be resized to fit the GIF.

This is what I've done so far:

Code: Select all

mogrify.exe -coalesce -draw "image Over 5,5 184,64 'big_watermark.png'" -layers Optimize *.gif
And it made the watermark jump all over the place (probably due to frame offsets?):
Image

1) How can I overlay the watermark relative to the canvas instead to each individual frame?
2) Is it possible to resize the watermark based on the GIF's height? E.g. larger watermark on larger GIFs and vice versa.

Files:
big_watermark.png: http://i.imgur.com/OZtDB5e.png
source.gif: http://i.imgur.com/OG5YM3C.gif

P.S.: I've managed to solve my first problem with `convert` but I'd love a IM one-liner to batch process all these GIFs with watermark resizing relative to source height.
My solution:

Code: Select all

convert.exe source.gif -coalesce -draw "image Over 5,5 184,64 'big_watermark.png'" -layers Optimize output.gif
Result (working as intended): http://i.imgur.com/OjGd9Ab.gif

Thanks!

Re: Watermarking an animated GIF with varied frame offsets and sizes

Posted: 2017-01-13T04:13:35-07:00
by snibgo
Mogrify has limited capabilities. I would do a single convert (or v7 magick) for each GIF, and run that inside a shell "for" loop.
coloring wrote:2) Is it possible to resize the watermark based on the GIF's height? E.g. larger watermark on larger GIFs and vice versa.
Sure. For example, you might want to make the watermark 20% of the GIF width and 10% of the GIF height. In v6, I would do that with a shell script: an identify command gets the dimensions and calculates the required size, then the convert resizes the watermark and composites it. In v7, it can be done in a single convert command.

Re: Watermarking an animated GIF with varied frame offsets and sizes

Posted: 2017-01-13T05:52:44-07:00
by coloring
OK. Thanks for the tips.
I'll go the v6 + shell route for now, due to familiarity and time restraints.
I will have to look into v7, though, it looks nice!