Question
Asked By – ustroetz
I am trying to read an image with scipy. However it does not accept the scipy.misc.imread
part. What could be the cause of this?
>>> import scipy
>>> scipy.misc
<module 'scipy.misc' from 'C:\Python27\lib\site-packages\scipy\misc\__init__.pyc'>
>>> scipy.misc.imread('test.tif')
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
scipy.misc.imread('test.tif')
AttributeError: 'module' object has no attribute 'imread'
Now we will see solution for issue: scipy.misc module has no attribute imread?
Answer
You need to install Pillow (formerly PIL). From the docs on scipy.misc
:
Note that Pillow is not a dependency of SciPy but the image manipulation functions indicated in the list below are not available without it:
…
imread
…
After installing Pillow, I was able to access imread
as follows:
In [1]: import scipy.misc
In [2]: scipy.misc.imread
Out[2]: <function scipy.misc.pilutil.imread>
This question is answered By – Wilduck
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0