Python Imaging Library and PyGTK - color image path?

Jeremy Bowers jerf at jerf.org
Fri Apr 22 22:43:13 EDT 2005


I have an image in the Python Image Library. I'm trying to get it into
PyGTK in color. Is there any way to do this cross-platform, preferably
without writing to anything to the disk?

PIL apparently can't write XPMs. GTK will only take XPMs, that I can see.
Therein lies the rub. I can ship over monochrome bitmaps via XBM, but I'd
rather be able to ship over full color.

(Use case, in case it matters: I am trying to embed a graphic into a text
widget. This is going fine. Because I want the text widget to be able use
different size text, and no one image can look right with everything from
8pt to 40pt text (all reasonable possibilities), I load a large image in
from the disk and scale it down as needed; the images are designed to
scale well and later I can make multiple source images if that is
desirable. But I can't figure out how to get the scaled image into GTK.
This surprises me.)

If there's an easy Google search, it has eluded me.



More information about the Python-list mailing list