< Python Imaging Library

Python is obviously a prerequisite for using PIL. The current version of PIL is 1.1.7, and this supports Python up to v.2.6.

PIL is available from PythonWare at this page. Source code can be built for any platform, and Windows binaries are available.

Installing PIL

Windows

To install on Windows machines, go to the page given above and download the appropriate binary executable for the version of Python that you have. Run this executable and follow the instructions given by the installer.

Linux

On Linux, you can either compile the source yourself, or install using your package manager. For Debian-based systems, apt-get can be used:

sudo apt-get install python-imaging

In Gentoo:

emerge imaging

Mac OS X

To install on a Mac OS X system , visit http://pythonmac.org and download the relevant .dmg file and install as any other application.

Using PIL

Once install you need to import the PIL modules you want to use. Basic functions are found in the Image module, so the following will work:

import Image

You can then access functions as usual, e.g. Image.load(filename). Uses of the other modules available are given in the overview section, and these are imported in exactly the same way.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.