How to read image from StringIO to PIL in python? I will have a stringIO object. How did I read from him with the image in it? The can not event does not read the image from the file. Wow!
from StringIO import StringIO from PIL import Image image_file = StringIO(open("test.gif",'rb').readlines()) im = Image.open(image_file) print im.format, "%dx%d" % im.size, im.mode Traceback (most recent call last): File "/home/ubuntu/workspace/receipt/imap_poller.py", line 22, in <module> im = Image.open(image_file) File "/usr/local/lib/python2.7/dist-packages/Pillow-2.3.1-py2.7-linux-x86_64.egg/PIL/Image.py", line 2028, in open raise IOError("cannot identify image file") IOError: cannot identify image file
python python-imaging-library
Tampa
source share