Search code examples
imagemagickpnggifanimated-gifimagemagick-convert

Animated gif created with ImageMagick has glitchy block color background


I am trying to stitch together a bunch of .png's which contain some alpha (transparency) but which have a uniformly white background. The png's look fine individually, but in the resulting .gif some frames acquire a patchy background that appears to have the same RGBA color as some of the points being animated.

example of glitchy behavior

I have tried the following commands

convert -delay 1 im*.png anim.gif
convert -delay 1 -alpha set im*.png anim.gif
convert -delay 1 -alpha set -dispose background im*.png anim.gif
convert -delay 1 -alpha set -dispose previous im*.png anim.gif
convert -delay 1 -alpha set -dispose previous -background white im*.png anim.gif

pretty much just trying additional flags to see if anything happens to fix the glitch, but I get the same behavior in every case. Anyone have a fix?


Solution

  • Ah, this question led me to the right answer --

    convert -delay 1 -layers Optimize im*.png anim.gif
    

    works!