Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PIL doesn't recognize jpeg library under Mac OS

Scripts like that:

from PIL import Image, ImageOps
img = Image.open('1.JPG')
thumb = ImageOps.fit(img, (200,200) , Image.ANTIALIAS, (0.5, 0.5))

cause this IOError:

Traceback (most recent call last):
  (...)
  File "/Library/Python/2.7/site-packages/PIL/Image.py", line 385, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

How do I get jpeg support for my PIL? That issue seems to be well known but the existing threads don't solve it for me. I use brew and pip for my python packages and have already tried the following:

  • brew install jpeg causes Error: jpeg-8d already installed
  • brew install libjpeg causes Error: jpeg-8d already installed
  • sudo pip install Pillow - installation works but does not change anything

How do I get jpeg support for my PIL installation? Any ideas?

like image 275
florianletsch Avatar asked Aug 05 '12 22:08

florianletsch


1 Answers

I don't understand why, but reinstalling PIL fixed the issue:

sudo pip uninstall pil
sudo pip install pil
like image 54
florianletsch Avatar answered Nov 07 '22 10:11

florianletsch