ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> image-sig
image-sig
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved