I had try http://mail.python.org/pipermail/image-sig/2010-June/006313.html, but I get a error still
dreampuf@HX:~/hub/lweibo$ python2.7 lweibo.py
Traceback (most recent call last):
File "lweibo.py", line 235, in <module>
lweibo_render(107906)
File "lweibo.py", line 228, in lweibo_render
p = LPic(a_body, a_title, a_ukey_nickname, a_ukey_img, a_create)
File "lweibo.py", line 114, in __init__
a_ukey_img.save("s.png", "PNG", qualty=100)
File "/Users/dreampuf/opt/macports/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Pillow-1.7.7-py2.7-macosx-10.7-x86_64.egg/PIL/Image.py", line 1406, in save
self.load()
File "/Users/dreampuf/opt/macports/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Pillow-1.7.7-py2.7-macosx-10.7-x86_64.egg/PIL/ImageFile.py", line 215, in load
raise_ioerror(e)
File "/Users/dreampuf/opt/macports/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Pillow-1.7.7-py2.7-macosx-10.7-x86_64.egg/PIL/ImageFile.py", line 52, in raise_ioerror
raise IOError(message + " when reading image file")
IOError: broken data stream when reading image file
then I try to use the Macports to install jpeg6b, but it’s alert me , jpeg6b is too old edition and rename to jpeg
dreampuf@HX:~/lweibo$ sudo port install jpeg6b
Password:
---> Configuring jpeg6b
Error: jpeg6b has been renamed to jpeg. Please install jpeg instead.
Error: Target org.macports.configure returned: obsolete port
Log for jpeg6b is at: /Users/dreampuf/opt/macports/var/macports/logs/_Users_dreampuf_opt_macports_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_jpeg6b/jpeg6b/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
but the edition of jpeg is 8d.
dreampuf@HX:~/hub/lweibo$ port installed jpeg
The following ports are currently installed:
jpeg @8d_0 (active)
I know what cause in this error. but i can’t to install jpeg6b in my system, or can’t reinstall PIL to use the jpeg6b.
I don’t understand the correlation between your first example writing out a PNG, and then talking about jpeg issues.
If you are relying on macports for your libjpeg, then why not use it to install PIL as well?
When building PIL you can tell it where to look for the JPEG libs:
export JPEG_ROOT=/usr/local/includeI would recommend removing PIL, removing libjpeg… Then reinstall the latest jpeg, and then rebuild PIL.
Try using pip to install PIL:
pip install -U PIL