Page 1 of 1

Masking an animated gif

Posted: 2010-12-02T05:21:19-07:00
by hellocatfood
I have an animated gif and I want to mask each frame of it then output an animated gif. I know I could separate the gif into individual frames, mask each frame and then put it back together, but just wondered if there's an easier way

Thanks

Re: Masking an animated gif

Posted: 2010-12-02T17:14:51-07:00
by anthony
In what way?

Just do a rectangular crop of the animation?
http://www.imagemagick.org/Usage/anim_m ... p_viewport


Or do you want to mask each frame using another image.
You can use the multi-image layers composition for this.
http://www.imagemagick.org/Usage/anim_mods/#composite

However unless you are willing to share an example animation and mask, we can not help you further.

Re: Masking an animated gif

Posted: 2010-12-02T17:35:13-07:00
by hellocatfood
So, I have this animated gif http://ubuntuone.com/p/RuN/ and I want to mask it using this image http://ubuntuone.com/p/RuK/ so that it looks a little like this, only animated. Is there a way to do this without having to separate the animated gif into individual frames?

Re: Masking an animated gif

Posted: 2010-12-02T19:25:18-07:00
by anthony
Your original animation has no timing delays!

however this does the job

Code: Select all

convert drink.gif -coalesce null: mask.jpg \
            -compose CopyOpacity -layers composite \
            drink_masked.gif
the "null:" image is important to mark the end of one sequence of images and the second compose image.

Re: Masking an animated gif

Posted: 2010-12-03T03:27:58-07:00
by hellocatfood
It worked, thanks so much! :-)