After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 55502 - Improper rendering
Improper rendering
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 71308 105131 (view as bug list)
Depends on:
Blocks: 105794
 
 
Reported: 2001-05-31 00:28 UTC by Eric Warmenhoven
Modified: 2010-07-10 04:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Animated butterfly (4.57 KB, image/gif)
2001-05-31 05:43 UTC, Eric Warmenhoven
  Details
the patch (887 bytes, patch)
2001-08-23 12:11 UTC, Matthias Clasen
none Details | Review
another gif (15.35 KB, image/gif)
2003-02-03 18:06 UTC, Oleg Klimov
  Details
patch (1.64 KB, patch)
2003-02-04 23:25 UTC, Matthias Clasen
none Details | Review

Description Eric Warmenhoven 2001-05-31 00:28:56 UTC
Some animated gifs are displayed with frames greyed out; others are
displayed with black backgrounds.
Comment 1 Havoc Pennington 2001-05-31 02:12:14 UTC
The GIF loader used to be completely broken; unfortunately the API was
also broken, it wasn't possible to correctly display an animation
using it even after the loader was fixed.

The CVS version of GTK has a new API for animation and lots of fixes
to the loader. For me your penguin image works fine and the butterfly
image has an odd white background that flashes (I'm testing with
testanimation). I'm leaving the bug open to fix the funny white
background on the butterfly.

I don't think it's possible to fix the stable version of gdk-pixbuf,
unfortunately, since the API is incorrect.

If you could leave the butterfly image online until this bug is closed
or attach the GIF to this bug, would appreciate it a lot.

Thanks!
Comment 2 Eric Warmenhoven 2001-05-31 05:43:24 UTC
Created attachment 598 [details]
Animated butterfly
Comment 3 Eric Warmenhoven 2001-05-31 05:44:17 UTC
I'm not sure about the reliability of the URL, so I'll attach it.
Comment 4 Matthias Clasen 2001-08-23 12:09:45 UTC
I ran gtk+/demos/testanimation on the butterfly and the only thing
I noticed was that the first frame get a solid white background instead of a transparent one. The attached one-liner fixes this.

 
Comment 5 Matthias Clasen 2001-08-23 12:11:06 UTC
Created attachment 943 [details] [review]
the patch
Comment 6 Havoc Pennington 2001-08-23 16:31:59 UTC
I always get alpha confused; I thought 255 was opaque? I'm sure I'm
misunderstanding the code.

If we make this change there's an equivalent place later in the code
that should also be changed (search for bg_transparent).
Comment 7 Owen Taylor 2001-08-23 17:27:20 UTC
Patch looks wrong to me too, without deep understanding
of the code ... 255 is definitely opaque, not transparent.
Comment 8 Matthias Clasen 2001-08-24 07:33:09 UTC
But the patch definitively fixed the problem of the first frame of 
the butterfly animation loosing its transparent background. Maybe
the real bug is somewhere else, I'll investigate further. 
Comment 9 Matthias Clasen 2001-08-24 07:56:54 UTC
Ok, the butterfly problem also goes away if I use 
composite_line_22_4a4 instead of composite_line_22_4a4_mmx_stub
in pixops_composite. So my previous patch is indeed wrong, instead
there seems to be a problem in the assembler code which I can't 
decipher...
Comment 10 Owen Taylor 2002-01-16 22:22:45 UTC
The function is called with bg_transparent == FALSE, and the
pixbuf that is rendered has all 255 for alpha; it's some
problem with the GIF loader.
Comment 11 Owen Taylor 2002-01-22 21:44:35 UTC
I don't expect we'll have time to look at this before 2.0.0

"Compressed Image Formats", by John Miano is supposed to 
contain useful information about the GIF format.
Comment 12 Matthias Clasen 2002-01-23 12:14:52 UTC
Here is a link to the gif89 spec:

http://www.cica.indiana.edu/graphics/image_specs/gif.89.format.txt
Comment 13 Matthias Clasen 2002-01-23 13:10:42 UTC
I have looked a bit deeper in the butterfly.gif and the result is
that it has background_index == 0 != gif89.transparent == 29. 

Thus gdk_pixbuf_gif_anim_frame_composite() may be formally correct
in using the nontransparent background color (which is white) for
filling the pixmap onto which to composite the frames.
But other tools seem to handle this differently. 
Maybe a better heuristic would be to fill the pixbuf with transparent
background if the first frame contains transparent pixels (which
is the case for butterfly.gif)
Comment 14 Havoc Pennington 2002-01-23 16:27:52 UTC
The GIF "spec" differs a bit from what all apps conventionally do with
GIFs, in my experience. So don't take the spec too seriously.

I know I spent a long time figuring out the background issue in the
past, and like a moron I neither wrote down what I discovered
nor saved any test images, unless there are comments in io-gif.c. 
:-(
Comment 15 Matthias Clasen 2002-01-25 08:34:29 UTC
I have studied gifsicle ( http://www.lcdf.org/gifsicle/ ) 
in some detail now, and it also takes the approach that 
the background is irrelevant if the first frame contains 
transparency: Trying to change the background pixel of butterfly.gif
to something else yields:

gifsicle butterfly.gif --background 29 > butterfly2.gif
gifsicle: warning: irrelevant background color
gifsicle: (The background will appear transparent because
gifsicle: the first image contains transparency.) 

And the companion gifview program indeed displays butterfly.gif
with a transparent first frame. 

Btw. the function in gifsicle for determining the background pixel
contains the following comment:

  /* This code is SUCH a PAIN in the PATOOTIE!! */

      
Comment 16 Owen Taylor 2002-02-12 21:11:32 UTC
*** Bug 71308 has been marked as a duplicate of this bug. ***
Comment 17 Owen Taylor 2002-03-25 23:27:40 UTC
Moving non-critical or hard to fix bugs to 2.0.2
Comment 18 Matthias Clasen 2002-04-05 13:33:59 UTC
Move open bugs from milestones 2.0.[012] -- > 2.0.3, since 2.0.2 is already out.
Comment 19 Owen Taylor 2002-06-12 22:23:49 UTC
Can we figure out a patch for this?
Comment 20 Owen Taylor 2002-12-15 05:37:29 UTC
http://lxr.mozilla.org/mozilla/source/modules/libpr0n/decoders/gif/imgContainerGIF.cpp

is the Mozilla source code ... it seems on quick inspection to 
_always_ clear the initial frame and "disposed" areas with
transparent pixels, no matter whether the frame has transparency
or not. But I don't really understand the code very well.

Comment 21 Oleg Klimov 2003-02-03 18:04:23 UTC
*** Bug 105131 has been marked as a duplicate of this bug. ***
Comment 22 Oleg Klimov 2003-02-03 18:06:36 UTC
Created attachment 14062 [details]
another gif
Comment 23 Oleg Klimov 2003-02-03 18:08:25 UTC
Attached .gif rendered fine with

Mozilla
GIMP
Internet Explorer
ACDSee

but wrong with GdkPixbuf. Background is black instead of being
transparent.
Comment 24 Matthias Clasen 2003-02-04 23:24:59 UTC
Here is a patch which does as you say Mozilla does: Always fill with
transparent initially. This inded seems to fix the problematic gifs.
Comment 25 Matthias Clasen 2003-02-04 23:25:57 UTC
Created attachment 14111 [details] [review]
patch
Comment 26 Oleg Klimov 2003-02-05 13:38:34 UTC
Patch works for me -- everything is fine! Thanks Matthias
Comment 27 Matthias Clasen 2003-02-19 22:57:08 UTC
Committed to both branches.
Comment 28 Bugzilla Maintainers 2004-04-01 23:44:57 UTC
The URL field has been removed from bugzilla.gnome.org. This URL was in the old URL field, and is being added as a comment so that the data is not lost. Please email bugmaster@gnome.org if you have any questions.

URL: 
http://www.cs.ucsb.edu/~warmen/pixbuf.html