Image.open() cannot identify image file - Python? -


i running python 2.7 in visual studio 2013. code worked ok when in spyder, when run:

import numpy np import scipy sp import math mt import matplotlib.pyplot plt import image import random  # (0, 1) n scale = 2.2666 # scale chosen 1 m = 2.266666666 pixels min_length = 150 # pixels  project_path = 'c:\\cimtrack_v1' im = image.open(project_path + '\\st.jpg') 

i end following errors:

traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "c:\cimtrack_v1\pythonapplication1\dr\trajgen.py", line 19, in <module>     im = image.open(project_path + '\\st.jpg')   file "c:\python27\lib\site-packages\pil\image.py", line 2020, in open     raise ioerror("cannot identify image file") ioerror: cannot identify image file 

why , how may fix it?


as suggested, have used pillow installer python 2.7. weirdly, end this:

>>> pil import image traceback (most recent call last):   file "<stdin>", line 1, in <module> importerror: no module named pil   >>> pil import image traceback (most recent call last):   file "<stdin>", line 1, in <module> importerror: no module named pil  >>> import pil.image traceback (most recent call last):   file "<stdin>", line 1, in <module> importerror: no module named pil.image  >>> import pil traceback (most recent call last):   file "<stdin>", line 1, in <module> importerror: no module named pil 

all fail!

i had same issue.

from pil import image 

instead of

import image 

fixed issue


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -