[Image-SIG] (transparent) PIL image to QImage conversion?
Orcan Ogetbil
oogetbil at phys.psu.edu
Sat Apr 8 21:10:33 CEST 2006
Hi,
I need to convert a PIL image to a QImage object so I
can display it in a PyQt application. I found a basic example at:
http://lists.kde.org/?l=pykde&m=114235100819012&w=2
There the PIL image is converted to a string using a jpeg encoder first;
then the string is converted to a QByteArray;
then Qimage's loadFromData() function is used for the final conversion to a
QImage object.
My problem is, the JPEG encoding kills the transparency of my PNG images.
When I
do RAW encoding, I get nothing from the QByteArray object. I also couldn't
get
the thing work with a GIF encoding. PIL's tostring() function doesn't support
PNG encoding.
Here I found a list of encodings PIL provides:
http://mail.python.org/pipermail/image-sig/2004-September/002908.html
Has anybody encountered this problem?
Can I use cStringIO.StringIO() instead of PIL's tostring() somehow?
Any solutions?
Thanks!
More information about the Image-SIG
mailing list