Blend Animation with image

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
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Blend Animation with image

Post by dognose »

I'm trying to blend a pattern onto an animtion

For a single frame, it works great,

composite -blend 50x50 frame.jpg pattern.jpg out.jpg

But, if I use an animated gif, it gets flattened.

I've looked into -layers Composite, but it just overlays it without any blending.

Is there anyway to blend an animation without having to disassemble the animation?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Blend Animation with image

Post by snibgo »

IM works on individual images, not animations. An animation is always disassembled before processing.

Without seeing your images, advice is difficult, but:

1. You probably need "-layers coalesce" to make complete individual frames from the input animation.
2. You might want "-layers optimize" at the end.
3. To composite an individual image with each of the animation frames, you probably want a "NULL:" between the frames and image, then "-layers composite".
4. To get a compose other than the default "over", you need a "-compose something".

See http://www.imagemagick.org/script/comma ... php#layers
See also the animation pages linked from http://www.imagemagick.org/Usage/
snibgo's IM pages: im.snibgo.com
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: Blend Animation with image

Post by dognose »

Is there a compose operator that does blending? I've studied all the examples. NONE of the animation examples involve blending.

I'm trying to make a generic function here that works for any animation, so deconstructing the animation is problematic.

Maybe there is a script here that efficiently deconstructs an animation, acts on each frame, then reassembles the animation?
(frame timing, looping, offsets need to be maintained)
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: Blend Animation with image

Post by dognose »

Some operators work fine with animations, some do not.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Blend Animation with image

Post by fmw42 »

Best I can suggest is to use -coalesce. Also see http://www.imagemagick.org/Usage/anim_mods/#composite
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Blend Animation with image

Post by snibgo »

dognose wrote:Is there a compose operator that does blending?
"convert -list compose" lists the available compose options. Near the top, you should find "Blend". Use it with, for example, "-define compose:args=25" for a 25% blend.
snibgo's IM pages: im.snibgo.com
Post Reply