Sunday, September 4, 2011

Python - Install Python Imaging Library

Python Imaging Library is an good open source imaging library http://www.pythonware.com/products/pil/index.htm

You require any version of Python 2.7.X in 32 bits. Get the Python Imaging Library 1.1.7 for Python 2.7and install the executable. It is rather straight forward.

For Linux, most Linux distribution comes with python-imaging package. You can perform yum install python-imaging to install it. However, the default package may be out-dated. For example, CentOS 5.5 only have python-imaging 1.1.5 package while the latest package from the web site is 1.1.7

So, if you want to install for Python Imaging 1.1.7, you will need to following my previous post http://thompsonng.blogspot.com/2011/09/python-linux-installation.html to install 2.7.X python.

Then, goes to Python Imaging Library 1.1.7 Source Kit to download the source for Python Imaging 1.1.7.

After that, at your Linux machine, do the following

1. tar -xzvf Imaging-1.1.7.tar.gz
2. python setup.py install

Note: point 2 assume that your install version of python is 2.7.X. If you have other version of python, please use the correct interpreter respectively.


If install successfully, you should be able to import Image and use their module

For example,

>>> import Image
>>> im = Image.open("your_image.jpg");





See http://gausssum.sourceforge.net/DocBook/ch01s03.html and http://www.pythonware.com/library/pil/handbook/introduction.htm


No comments:

Post a Comment