By default, PIL doesn't have jpeg support on the Raspberry Pi, so it returns the following:
IOError: decoder jpeg not available
This can also be seen while installing PIL:
*** JPEG support not available
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
TL;DR: uninstall PIL, install and link libjpeg-dev, and reinstall PIL.
The general solution is to install libjpeg-dev before installing PIL:
sudo apt-get install libjpeg8-dev
However, PIL still doesn't know where to find the shared library. Following the general solution (above) doesn't work since the Pi is ARM-based, not intel32/64. Still, it isn't hard to find the library and link it:
find /usr/lib -name libjpeg.so /usr/lib/arm-linux-gnueabihf/libjpeg.so sudo ln -s /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/
reinstalling PIL works properly now:
sudo pip install PIL ... --- JPEG support available
Another solution is to install PIL (actually, the Pillow fork) via,
sudo apt-get install python-imaging
as recommended in this answer. This will also install the dependencies required for JPEG support.