I run OS X 10.6.7, Python 2.6 and write a small wxPython application that uses PIL to control the image and add some text to it.
After a few configuration problems, trying to get the PIL running with libjpeg and PIL, I followed the instructions on this site .
When I run python setup.py build_ext -i
(from inside the Imaging-1.1.7 folder) I get:
Also, by running python selftest.py
in the Imaging-1.1.7 installation folder, I get:
-------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from ./PIL Binary modules loaded from ./PIL -------------------------------------------------------------------- --- PIL CORE support ok --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok --- LITTLECMS support ok -------------------------------------------------------------------- Running selftest: --- 57 tests passed.
However, when rendering my first PIL image in my own code, I still get:
File "/Library/Python/2.6/site-packages/PIL/Image.py", line 1290, in resize self.load() File "/Library/Python/2.6/site-packages/PIL/ImageFile.py", line 215, in load raise_ioerror(e) File "/Library/Python/2.6/site-packages/PIL/ImageFile.py", line 52, in raise_ioerror raise IOError(message + " when reading image file") IOError: broken data stream when reading image file
I do not seem to understand what to do next. Any ideas? The code causing this failure is as follows:
try: self.img = self.img.resize((self.screenwidth, self.screenheight), Image.ANTIALIAS) except IOError, e: print "Error resizing: " + str(e) self.img = self.img.resize((self.screenwidth, self.screenheight)) raise