最近在OpenBSD上安裝Python image Library(簡稱 pil)時發現幾個問題,就在當我要去使用到imageFont物件時會出現底下的錯誤訊息: >>> import _imagingft dlopen("/usr/local/lib/python2.4/site-packages/pil/_imagingft.so", 2); Traceback (most recent call last): File "", line 1, in ? ImportError: File not found 這個表示在安裝pil時在指定FreeType2 的include路徑時有問題。 而如果出現的不是File not found,而是 Impo...
by speakitnow - Python文档中心 - 2008-08-21 12:26:37 阅读(2933) 回复(0)
一、安装 在官方网(http://www.pythonware.com/products/pil/)上可以找到软件安装包,在windows下安装很方便,要注意与Python的版本相匹配。 二、概述 pil主要应用于图片处理方面,与GDAL不同,针对栅格图片,也就是常说的数字图像处理,而GDAL的处理数据包括矢量、栅格数据,与GIS结合相当紧密。 pil的优势在于图片的数字处理,如:图片的大小,旋转,增强等。 三、主要模块及功能 1、image Fuctions and Methods: open>>im=Ima...
用pil处理image: [code] try: im = image.open(image) im_grey = im.convert('L') except IOError, strerror: print "I/O error: %s on %s" % (strerror, image) os.remove(image) [/code] 在Linux下运行正常,即使有些图片转换的时候会陷入except,也能正常删除。 但是在windows下删除一个没有关闭的文件是要报windows32错误的。 但是查了一下pil的manual,也...
转:oyzway pil 中的 image 模块 本文是节选自 pil handbook online 并做了一些简单的翻译 只能保证自己看懂,不保证翻译质量。欢迎各位给出意见。 ------------------------------------------------------ image 模块提供了一个同名类(image),也提供了一些工厂函数,包括从文件中载入图片和创建新图片。例如,以下的脚本先载入一幅图片,将它旋转 45 度角,并显示出来:[code] 1 >>>from pil import image 2 >>>i...
在做图片的缩略的时候出现image file is truncated (43 bytes not processed)?????
在使用ttf “simhei.ttf” 也就是黑体,生成字体图片的时候,对于汉字,当fontsize 设置为21的时候,汉字显示正常,当小于21的时候,汉字不正常,请问谁清楚这个问题?[code]Font = imageFont.truetype('E:\\image\\simhei.ttf,21) Img = image.new("RGBA", (200,200),(255,255,255)) Draw = imageDraw.imageDraw(img, "RGBA") Draw.setfont(font) Draw.text((10, 10), u"爱情", fill='black') Img.show() [/...
利用pil来将处理图片,并将字符串跟图片合到一起来产生验证码图片,简单的代码如下: def make_image(image='test.jpg'): import image, imageDraw, imageFont, md5, datetime im = image.open(image) font = imageFont.truetype("arial.ttf", 30) draw = imageDraw.Draw(im) mp = md5.new() mp_src = mp.update(str(datetime.datetime.now())) mp_src = mp.hexdigest() rand_str = ...
PythonWare公司提供了免费的图像处理工具包pil(python image library),该软件包提供了基本的图像处理功能.pil提供了丰富的功能模块:image,imageDraw,imageEnhance,imageFile等等。最常用到的模块是image,imageDraw,imageEnhance这三个模块。 1,image module >>import image >>f = image.open('t.jpg') #open image >>f.save('s.jpg') ...
如题,我现在用canvas将一个tk image做出了改变之后,怎么才能把它变成pil image然后才能保存呢?急啊~~谢谢了!~~
# -*- coding: cp936 -*- import os import ctypes from pil import imageGrab class RECT(ctypes.Structure): _fields_ = [('left', ctypes.c_long), ('top', ctypes.c_long), ('right', ctypes.c_long), ('bottom', ctypes.c_long)] def __str__(self): return str((self.left, self.top, self.right, self.bottom)) def capture(hwnd,tempdir): """ 对...