What happened to the following snippet?
This is not related to the image format, I tried with both jpg and png.
import Image from cStringIO import StringIO with open('/path/to/file/image.png') as f: data = f.read() img = Image.open(StringIO(data)) img.load() Traceback (most recent call last): File "<stdin>", line 4, in <module> File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 2030, in open raise IOError("cannot identify image file") IOError: cannot identify image file
EDIT:
This happens with a randomly downloaded image from the Internet and the following most basic fragment:
import Image im = Image.open('WicZW.jpg') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 2030, in open raise IOError("cannot identify image file") IOError: cannot identify image file
Enuy source share