Resizing an animated gif causes frames to gain background

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
abxccd
Posts: 4
Joined: 2012-04-10T21:53:29-07:00
Authentication code: 8675308

Resizing an animated gif causes frames to gain background

Post by abxccd »

I am trying to resize this animated GIF: Image

First I run coalesce:

Code: Select all

convert beaver.gif -coalesce temporary.gif
This results in: Image

Then I resize:

Code: Select all

convert -size 80x168 temporary.gif -resize 40x40 smaller.gif
Which results in: Image

In step 2, when we do the coalescing, the animation is damaged as the frames now gain a background. Why does this happen? How can this be prevented?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing an animated gif causes frames to gain backgroun

Post by fmw42 »

set your background to none (transparent)

convert xZ27hT5.gif -background none -resize 40x40 new_animation.gif
abxccd
Posts: 4
Joined: 2012-04-10T21:53:29-07:00
Authentication code: 8675308

Re: Resizing an animated gif causes frames to gain backgroun

Post by abxccd »

Is there anyway to do this when using coalesce as well?

I tried the following, but the problem still exists.

Code: Select all

convert beaver.gif -coalesce -background none temporary.gif
convert -size 80x168 temporary.gif -resize 40x40  -background none smaller.gif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing an animated gif causes frames to gain backgroun

Post by fmw42 »

Why do you need the coalesce if it works without it? Nevertheless, this works for me on IM 6.8.7.10 Q16 Mac OSX


convert xZ27hT5.gif -background none -coalesce -resize 40x40 tmp.gif
Post Reply