Python Imaging Library and PyGTK - color image path?
Fredrik Lundh
fredrik at pythonware.com
Sat Apr 23 04:20:29 EDT 2005
Jeremy Bowers wrote:
>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.
the first two google hits for "PyGTK PIL" are
http://www.daa.com.au/pipermail/pygtk/2005-April/009988.html
which provides a StringIO-based solution, and
http://www.daa.com.au/pipermail/pygtk/2003-February/004393.html
which discusses draw_rgb_image and friends, and says that "if you can convert
your PIL image to a pixel data string or buffer object, you could use them to
display the image". here's some code that seems to do exactly that:
http://www.mail-archive.com/pygtk@daa.com.au/msg07167.html
(but maybe this is some kind of stupid "a bitmap isn't a pixmap isn't an image"
thing? if so, I suggest getting a modern windowing system ;-)
</F>
More information about the Python-list
mailing list