Feb 3, 2012

PIL with JPEG, ZLIB, FREETYPE2, LITTLECMS support in virtualenv on Ubuntu 11.10

To enable JPEG and PNG support install:
sudo apt-get install libjpeg8 libjpeg8-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install liblcms1 liblcms1-dev
On x64 system symlink libraries:
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/liblcms.so /usr/lib
cd /usr/include
ln -s freetype2 freetype
And finally in your virtualenv:
pip install PIL
You should see somethings like this during installation:
    PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.6.7 (r267:88850, Aug 11 2011, 12:18:09)
                  [GCC 4.6.1]
    --------------------------------------------------------------------
    *** TKINTER support not available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available
    --- LITTLECMS support available
    --------------------------------------------------------------------

To check, for example jpeg support, execute:
python -vvv -c "import _imaging" 2>&1 | grep jpeg
Should output:
#   clear[2] jpeg_encoder
#   clear[2] jpeg_decoder
#   clear[2] jpeglib_version

No comments: