Error in PIL installed with PIP - Django,Python
My fix for this is to make sure you have packages libjpeg-dev and libpng-dev installed before doing the pip install of PIL. 
sudo apt-get install libjpeg-dev libpng-dev 
will probably do. Then pip gets PIL from source, compiles with jpeg and png support.
I installed PIL using PIP. However, using PIL on Django, when trying to upload a .jpg file, I get the error:

Upload a valid image. The file you uploaded was either not an image or a corrupted image.

I read on the Internet about this error and a solution was to delete the compiled files for the current OS, then use setup.py again.
However, as I installed PIL with PIP, I have no setup.py and no folder with files compiled for my particular OS. This is Mac OSX Lion.
Update: I did not have libjpeg installed on my computer. I have it now and I am trying to change the PIL configuration to point to the libjpeg library.