如何将PIL image转成wx.Image与wx.Bitmap
1个回答
2016-12-20 · 知道合伙人软件行家
关注
展开全部
from PIL import Image
import wx
pilImage = Image.open('my.png')
image = wx.EmptyImage(pilImage.size[0],pilImage.size[1])
image=image.ConvertToImage()
image.setData(pil.convert("RGB").tostring())
image.setAlphaData(pil.convert("RGBA").tostring()[3::4]
## use the wx.Image or convert it to wx.Bitmap
bitmap = wx.BitmapFromImage(image)
import wx
pilImage = Image.open('my.png')
image = wx.EmptyImage(pilImage.size[0],pilImage.size[1])
image=image.ConvertToImage()
image.setData(pil.convert("RGB").tostring())
image.setAlphaData(pil.convert("RGBA").tostring()[3::4]
## use the wx.Image or convert it to wx.Bitmap
bitmap = wx.BitmapFromImage(image)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询