# -*- coding: utf-8 -*- from PIL import Image import wx '''PIL Image''' pilImage = Image.open('1.png') '''wx.Image''' wxImg = PilImg2WxImg(pilImage) '''wx.Bitmap''' bitmap = wx.BitmapFromImage(wxImg) '''wx.StaticBitmap''' staticBitmap = wx.StaticBitmap(parent, -1, imgObj) def PilImg2WxImg(pilImg): '''PIL的image转化为wxImage''' image = wx.EmptyImage(pilImg.size[0],pilImg.size[1]) image.SetData(pilImg.convert("RGB").tostring()) image.SetAlphaData(pilImg.convert("RGBA").tostring()[3::4]) return image def WxImg2PilImg(wxImg): '''wxImage转化为PIL的image''' pilImage = Image.new('RGB', (wxImg.GetWidth(), wxImg.GetHeight())) pilImage.fromstring(wxImg.GetData()) if wxImg.HasAlpha(): pilImage.convert( 'RGBA' ) wxAlphaStr = wxImg.GetAlphaData() pilAlphaImage = Image.fromstring( 'L', (wxImg.GetWidth(), wxImg.GetHeight()), wxAlphaStr ) pilImage.putalpha( pilAlphaImage ) return pilImage
相关推荐
安装方法: 1.tar -zxf PIL-1.1.7.tar 2.cd PIL-1.1.7 3.python setup.py install
Image和arry需要相互转化,转化的真正目的,就是将图片运算中,由Uint8转成int32、int64、float32 等,然后进行函数变换,最后再方便地显示出来。整个过程需要numpy与image互转;本项目就是演示这个过程,对于图像...
用Python+PIL进行图像处理.doc详细介绍了python的pil模块使用。
In the past I have written a plug-in architecture for one of my MFC projects. This architecture, although it worked, was limited in what it could provide, in that the executable/DLL had to know about ...
OpenCV转换成PIL.Image格式: import cv2 from PIL import Image import numpy img = cv2.imread("plane.jpg") cv2.imshow("OpenCV",img) image = Image.fromarray(cv2.cvtColor(img,cv2.COLOR_BGR2RGB)) image....
当使用PIL.Image.open()打开图片后,如果要使用img.shape函数,需要先将image形式转换成array数组 img = numpy.array(image) 或者 img = np.asarray(image) array和asarray都可将结构数据转换为ndarray类型。但是...
资源分类:Python库 所属语言:Python 资源全名:weditor-0.0.4.dev7.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
python图形处理库PIL(Python Image Library),免费,windows下安装程序
Python调用PIL实现图片合成(含证件照换背景) https://xercis.blog.csdn.net/article/details/107979207
PIL-1.1.7.win32-py2.7.exe
Write your own Digital Image Processing programs with the use of pillow, scipy.ndimage, and matplotlib in Python 3 with Raspberry Pi 3 as the hardware platform. This concise quick-start guide provides...
pil自动截图代码,import time import os from PIL import ImageGrab
另外,在GUI库中,也有各自定义的图像处理机制,比如wxPyton,定义了wx.Image做为图像处理类,定义了wx.Bitmap做为图像显示类。 下图梳理出了PIL读写图像文件、cv2读写图像文件、PIL对象和cv2对象互转、PIL对象和wx....
pil python image
PIL-1.1.6.win32 PIL-1.1.6.win32PIL-1.1.6.win32PIL-1.1.6.win32
PIL-1.1.6.win32-py2.6.exePIL-1.1.6.win32-py2.6.exePIL-1.1.6.win32-py2.6.exePIL-1.1.6.win32-py2.6.exePIL-1.1.6.win32-py2.6.exe
python库。 资源全名:large-image-source-pil-1.3.3.dev48.tar.gz
python库。 资源全名:large-image-source-pil-1.7.2.dev14.tar.gz
python库。 资源全名:large-image-source-pil-1.6.3.dev17.tar.gz
PIL-1.1.7.win32-py2.7, PIL图库 资源 安装包, 解压后双击 即可安装