码迷,mamicode.com
首页 > 编程语言 > 详细

PIL:Python Imaging Library(图像处理标准库)

时间:2015-04-25 16:24:43      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

安装PIL

Mac或Linux安装命令:sudo easy_install PIL

如果报错:fatal error: ‘freetype/fterrors.h‘ file not found

Mac下所依赖的FreeType链接变更问题,解决如下:

ln -s /usr/local/include/freetype2 /usr/local/include/freetype

sudo easy_install -U pil

如果出现问题:decoder jpeg not available

卸载你的PIL

下载libjpeg:http://www.ijg.org/files/jpegsrc.v7.tar.gz

安装libjpeg:

$ tar zxvf jpegsrc.v7.tar.gz 
$ cd jpeg-7 
$ ./configure --enable-shared --enable-static 
$ make 
$ sudo make install

下载PIL: http://effbot.org/downloads/Imaging-1.1.7.tar.gz

编辑setup.py,设置:

JPEG_ROOT = libinclude("/usr/local")

ZLIB_ROOT = libinclude("/usr/local")

安装PIL

$ python setup.py build 
$ sudo python setup.py install --optimize=1 
$ python selftest.py - Run the selftest to confirm PIL is installed ok 
$ sudo python setup.py install 

重启IDLE

使用例可参考:

实例

详细了解PIL,请参考PIL官方文档:

http://effbot.org/imagingbook/

Qrcode:生成二维码

安装 qrcode:sudo easy_install qrcode

测试代码(在命令行输入):qr "test" > test.png

 

PIL:Python Imaging Library(图像处理标准库)

标签:

原文地址:http://www.cnblogs.com/ryuham/p/4455954.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!