[pygtk] Displayed gtk.Image have fewer colors than the source pixbuf

Pontus Ekberg pontus.ekberg.7897 at student.uu.se
Fri Jan 13 07:55:48 WST 2006

I am writing an image viewer that uses PyGTK. The displayed images do
not look as good as expected though. When there should be soft
transitions between colors I get stripes instead, as if the number of
colors that can be displayed is limited to a relativly low number.

For an example look at these two images.

This is how it should look: http://home.student.uu.se/poek7897/nice.png

This is how it is displayed: http://home.student.uu.se/poek7897/ugly.png

I know there is nothing wrong with the pixbuf, for if I save it to a
file right before I do the gtk.Image.set_from_pixbuf() it will have all
the colors intact.

I figured there might be something I should do with gtk.gdk.colormap or
gtk.gdk.Visual, but I have tried everything I can think of with a few
seg faults as the only results.

I have also noticed that some other GTK image viewers have the exact
same problem, while some others have not. I know some C programs with
the problem and some without, but I have not found any in PyGTK that
have solved it. Looking at the code for these C programs have not given
me any ideas though.

Any ideas on the cause of this?

Pontus Ekberg

More information about the pygtk mailing list