GIF does not always save transparency!

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

GIF does not always save transparency!

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: GIF does not always save transparency!

Post 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.
Post Reply