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.
You get this error if PIL is compiled without jpeg support. I also got this when the destination directory was not writeable.
Once PIL has compiled, if you read
the library for handling JPEG files, or part of it, is missing. Fix this just installing the library (in my case it was libjpeg62-dev) and run pip again, maybe inside a virtualenv. If this is not enough, probably your system has some more quirk. Look at this post (ubuntuforums) for the fix.