Create wxBitmap from PIL

Greg Landrum glandrum at my-deja.com
Wed Jul 12 00:24:47 EDT 2000


In article <396B8134.8E5426B9 at engineering.uiowa.edu>,
  jtschirr at engineering.uiowa.edu wrote:
>
> How can I create a wxBitmap image from a Python Imaging Library (PIL)
> image?
>

Here's some sample code:
def PilImgToWxBmp(pilImg):
  wxImg = wxEmptyImage(pilImg.size[0],pilImg.size[1])
  wxImg.SetData(pilImg.tostring())
  bmp = wxImg.ConvertToBitmap()
  return bmp

I hope this helps,
-greg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list