PIL图片转换为wx.Bitmap



from PIL import Image
import wx

pilImg = Image.open('test.png')
img = wx.EmptyImage(
pilImg.size[0],pilImg.size[1])

img.setData(pilImg.convert("RGB").tostring())
img.setAlphaData(pilImg.convert("RGBA").tostring()[3::4]

## use the wx.Image or convert it to wx.Bitmap
bmp = wx.BitmapFromImage(img)

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:

Leave a Reply

Your email address will not be published. Required fields are marked *