PIL安装使用

PIL简介

图像处理是一门应用非常广的技术,而拥有非常丰富第三方扩展库的 Python 当然不会错过这一门盛宴。PIL (Python Imaging Library)是 Python 中最常用的图像处理库,目前版本为 1.1.7,参考官方资料http://effbot.org/imagingbook/

Image 类是 PIL 库中一个非常重要的类,通过这个类来创建实例可以有直接载入图像文件,读取处理过的图像和通过抓取的方法得到的图像这三种方法。

注意PIL与pillow不兼容。

安装

window7与CenOS7下安装PIL的方法不同,以下方法仅作参考

CentOS7

  1. 依赖库安装:yum install -y python-devel libjpeg libjpeg-devel zlib zlib-devel freetype freetype-devel lcms lcms-devel
  2. 下载最新的PIL包:wget http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
  3. 手动安装:

    tar zxvf Imaging-1.1.17.tar.gz
    cd Imaging-1.1.7/
    python python setup.py install

window7 64bit

pillow有32bit与64bit之分,具体安装请参考官方资料https://pillow.readthedocs.org/en/latest/installation.html,或者手动下载https://pypi.python.org/pypi/Pillow,Pillow-3.1.1-cp27-none-win_amd64.whl,然后手动安装pip install Pillow-3.1.1-cp27-none-win_amd64.whl

或者从第三方网站下载对应的安装包:http://www.lfd.uci.edu/~gohlke/pythonlibs/

参考:

猜你喜欢

转载自blog.csdn.net/callinglove/article/details/50824405