[PyKDE] (transparent) PIL image to QImage conversion?
david at boddie.org.uk
Sun Apr 23 22:20:53 BST 2006
On Thu, 6 Apr 2006 16:37:07, "ORCAN OGETBIL" wrote:
> 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:
> Has anybody encountered this problem?
> Can I use cStringIO.StringIO() instead of PIL's tostring() somehow?
> Any solutions?
If you haven't already solved this problem, you might want to try saving
the contents of the Image to a StringIO object then reading the data
stored in the StringIO into a QImage. Try something like this:
# im is an existing PIL Image object.
from qt import QImage
from cStringIO import StringIO
s = StringIO()
image = QImage()
Hope this is useful,
More information about the PyQt