[Image-SIG] How to convert from transparent PIL to transparent wx.Image ?

Laszlo Zsolt Nagy gandalf at designaproduct.biz
Sun Sep 18 11:16:11 CEST 2005


This is what I have now:

def piltoimage(pil):
    """Convert PIL Image to wx.Image."""
    image = wx.EmptyImage(pil.size[0], pil.size[1])
    new_image = pil.convert('RGB')
    data = new_image.tostring()
    return image

But this does not work if I try to use 'RGBA' mode. Do you know a solution?


More information about the Image-SIG mailing list