Python Imaging Library


Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. It is available for Windows, and Linux. The latest version of PIL is 1.1.7, was released in September 2009 and supports Python 1.5.2–2.7, with Python 3 support to be released "later".
Development appears to be discontinued, with the last commit to the PIL repository coming in 2011. Consequently, a successor project called Pillow has forked the PIL repository and added Python 3.x support. This fork has been adopted as a replacement for the original PIL in Linux distributions including Debian and Ubuntu.

Capabilities

Pillow offers several standard procedures for image manipulation. These include:
Some of the file formats supported are PPM, PNG, JPEG, GIF, TIFF, and BMP.
It is also possible to create new file decoders to expand the library of file formats accessible.

Usage example

This example loads an image from the hard drive and blurs it.

from PIL import Image, ImageFilter # imports the library
original = Image.open # load an image from the hard drive
blurred = original.filter # blur the image
original.show # display both images
blurred.show

This example loads and rotates an image by 180 degrees

from PIL import Image #imports the library
im = Image.open #loads the image
rotated = im.rotate # rotates the image by 180 degrees
saved = rotated.save #saves the rotated image

This example loads and crops an image
from PIL import Image # import Image library
im = Image.open #read/load image
im1 = im.crop) # crop image
im2 = im1.save#save image

License

The Python Imaging Library is
Copyright © 1997-2011 by Secret Labs AB
Copyright © 1995-2011 by Fredrik Lundh
Based on