[Image-SIG] (transparent) PIL image to QImage conversion?
by Orcan Ogetbil other posts by this author
Apr 8 2006 12:31PM messages near this date
Re: [Image-SIG] Problem with JPEG and CMYK color space
|
[Image-SIG] PhotoImage Class
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!
_______________________________________________
Image-SIG maillist - Image-SIG@[...].org
http://mail.python.org/mailman/listinfo/image-sig
|