[PyKDE] Using PIL in PyQT
Diez B. Roggisch
deets at web.de
Sat Nov 26 14:55:12 GMT 2005
Rajeev Joseph Sebastian wrote:
> Hello all,
>
> Is it possible to load images using PIL and draw them on screen using PyQt ?
> Does anyone have any code snippet that could make this possible ?
Certainly. Qt supports some powerful formats, e.g. PNG. So open a image
with PIL, and serialize it to memory using cStringIO as a PNG. The load
it as QImage from there, providing the data as binary string by the
means of a QByteArray. Module struct or ctypes might come in handy here.
Other data formats may be even better - try whatever suits you best.
However I don't have code - but I guess you get the gist.
Diez
More information about the PyQt
mailing list