Page 1 of 1

GIF does not always save transparency!

Posted: 2010-08-18T20:30:10-07:00
by anthony
GIF read is failing in some special cases....

Download a GIF animation from IM Examples
http://www.imagemagick.org/Usage/anim_b ... s_bgnd.gif
Image

Now I generate the "Disposal Images" of this animation.
This shows how the 'GIF background disposal' is 'clearing' the overlayed frames to transparency!

Code: Select all

  convert  canvas_bgnd.gif -layers Dispose canvas_bgnd_dispose.gif
here is the animated GIF image.
Image

As you can see the GIF animation works fine.

However anytime IM reads this image (for display, animate, or just to work on the image) the transparent parts of the image are filled to the background color and NOT to transparency!

For example read this GIF and append frames and all the transparent areas are filled in!

Code: Select all

convert canvas_bgnd_dispose.gif +append canvas_bgnd_dispose.png
Image

Or just reading and writing the GIF fills in the transparency.

Code: Select all

convert canvas_bgnd_dispose.gif canvas_bgnd_dispose_rw.gif
Image
The above should should have remained completely unchanged as I have not done anything but read and write it!

This ONLY happens with GIF animations,
ONLY if the first frame is fully-opaque, and later frames have transparency.
and ONLY on GIF read.

This is nothing to with applying GIF disposal methods. Just the read of the GIF and not making use of the dispose / animation aspect of the GIF image.


this bug has existed for more than a year now, though I though it was in -layers Dispose. However the above shows the bug is in GIF animation reading, as using a brwser to display the GIF animation is fine, only IM read is not correct.

Re: GIF does not always save transparency!

Posted: 2010-08-18T20:37:12-07:00
by fmw42
Testing on Mac OSX Tiger IM 6.6.3.7 Q16 (HDRI) gives me an error message:


convert canvas_bgnd.gif -layers Dispose canvas_bgnd_dispose.gif

convert canvas_bgnd_dispose.gif canvas_bgnd_dispose_rw.gif
convert: invalid colormap index `canvas_bgnd_dispose.gif' @ error/colormap-private.h/ConstrainColormapIndex/34.