Flickr Badge

Thursday, September 01, 2011

Installing Python Imaging Library on Ubuntu

Continuing on setting up the VPS, its now time to install the Python Imaging Library. This is another major pain in the neck.

On Windows, PIL comes nicely bundled with everything. On Linux, it gets compiled, and the stupid part is that different bits of support get compiled in depending on what you have installed. PIL will silently skip components and say that the compile was successful. It's only when you run the application do you find out that some parts of PIL are not installed. Big, big, pain. If you are doing automated provisioning of machines, then you have to be careful that you have the right packages in place before you pip install PIL.

The two components that I am interested are PNG support and Truetype font support, because thats what we use for our app.

PNG Support

If you want PNG support, you need to have the zlib library installed.
sudo apt-get install zlib1g

sudo apt-get install zlib1g-dev
JPEG Support

JPEG requires libjpeg62
sudo apt-get install libjpeg62

sudo apt-get install libjpeg62-dev
TrueType Support

You'll need the libfreetype6 package installed
sudo apt-get install libfreetype6

sudo apt-get install libfreetype6-dev