Jpeg is not available.

Possible duplicate:
pip install PIL -E TICKETS-1 - No JPEG / PNG support

I am working on cropping an image and am having problems with my form validation. The form is validated when the GIF image is loaded, but any other format I try causes the following exception:

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

The form

<form enctype="multipart/form-data" method="post" action="/pic/">{% csrf_token %}
    {{ form.as_p }}
    <p><input type="submit" value="View uploaded image"></p>
    <input type="hidden" name="stage" value="crop">
</form>

View

if request.method == 'POST':
        form = ProfilePicForm(request.POST, request.FILES)
        if form.is_valid():
            *do stuff*
        else:
            logger.debug('Form errors == [%s]' % form.errors)

I installed libjpeg-dev (using apt-get) before installing PIL (using easy_install). At first I thought that this might be due to the incorrect installation of libjpeg-dev or PIL, but will the problem persist in other formats such as png? This problem does occur for png images as well. I am not getting a problem with the jpeg decoder, so I think this is not the case, but I'm not sure. In addition, I am using the django development server.


Update

PIL. PIL /usr/local/lib/python2.7/dist-packages/PIL   PIL.pth( dist-packages). setup.py script sudo python setup.py install. selftest.py script, :

--------------------------------------------------------------------
PIL 1.1.7 TEST SUMMARY 
--------------------------------------------------------------------
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
*** JPEG support not installed
*** ZLIB (PNG/ZIP) support not installed
*** FREETYPE2 support not installed
--- LITTLECMS support ok
--------------------------------------------------------------------
Running selftest:
*****************************************************************
Failure in example:
try:
 _info(Image.open(os.path.join(ROOT, "Images/lena.jpg")))
except IOError, v:
 print v
from line #24 of selftest.testimage
Expected: ('JPEG', 'RGB', (128, 128))
Got: decoder jpeg not available
1 items had failures:
   1 of  57 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 57 failed.

, PIL , . , zlib1g-dev, libfreetype6-dev, liblcms1-dev libjpeg62-dev, , , apt-get, , .

+5
1

PIL , setup.py, :

add_directory(library_dirs, "/usr/lib/i386-linux-gnu")

(214):

add_directory(library_dirs, "/usr/lib")

sudo python setup.py install

+11

All Articles