“ERROR: broken data stream when reading image file” (TrueType fonts libjpeg and PIL on OS X)

后端 未结 3 1050
遇见更好的自我
遇见更好的自我 2021-01-06 06:41

I\'m running OS X 10.6.7, Python 2.6, and writing a small wxPython application that uses PIL to manipulate an image and add some text to it.

After quite a bit of con

相关标签:
3条回答
  • 2021-01-06 07:03

    I've got a similar error when reading .jpg file with an up-to-date Python environment and Sierra Mac OS. I've found a quick workaround which consists to convert all the .jpg files to .png files Hoping that can help someone else.

    0 讨论(0)
  • 2021-01-06 07:07

    I was able to use PIL with the homebrew package manager.

    0 讨论(0)
  • 2021-01-06 07:23

    You should consider uninstalling PIL and following the instructions on this website - http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/

    In particular, it appears that you want to make sure that libjpeg is at version 6b, not 8c (see below)


    I am able to reproduce this with Mac OS X 10.5 using macports

    This is related to a another question: How to solve IOError:broken data stream when reading image file?

    The answer there indicates that the bug might have something to do with libjpeg

    As far as I can tell, the error appears to be caused by a forward incompatibility with libjpeg v8c.

    I cannot determine what is causing this exactly; all I can say is that on a variety of other systems I use that aren't exhibiting this behavior error (OS X 10.5 with fink, Redhat 5.2, Ubuntu 11.10 and 10.10), they all use libjpeg 6b. Only macports uses 8c, and macports is the only system where I am getting this error.

    0 讨论(0)
提交回复
热议问题