Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I've got error which is generated by PIL when I trying to process jpg-images: Python Imaging Library (PIL) Decoder jpeg not available.

How to fix this problem?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

PIL is missing libjpeg library.

To install it:

  1. Go to http://www.ijg.org/files/jpegsrc.v8c.tar.gz
  2. Unpack this package and cd to the unpacked folder cd ~/Downloads/jpeg-8c
  3. Compile it:
    ./configure
    make
    
  4. Then install: sudo make install

But PIL still can't find library. Now you need to reinstall it:

  1. Uninstall pil (if you instlled it with pip, just type sudo pip uninstall pil)
  2. Download PIL, unpack it and move to source folder.
  3. Now open setup.py in your code editor
  4. Replace JPEG_ROOT = None with JPEG_ROOT = libinclude("/usr/local")
  5. Enjoy! Now it works!
share|improve this answer
    
works perfect.. +1 for wonderful answer –  arthankamal Nov 18 '13 at 15:17

You could also install it from MacPorts. They have PIL for several versions of Python.

py-pil @1.1.7 (python, graphics)
    Python Imaging Library

py24-pil @1.1.7 (python, graphics)
    Python Imaging Library

py25-pil @1.1.7 (python, graphics)
    Python Imaging Library

py26-pil @1.1.7 (python, graphics)
    Python Imaging Library

py27-pil @1.1.7 (python, graphics)
    Python Imaging Library

Check out the site for how to install MacPorts, then just type sudo port install py-pil (or one of the other versions, such as py27-pil). Wait a while and you should have a working PIL, assuming you use the version of Python for which the PIL was installed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.