scipy.misc module has no attribute imread?
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops
--
Chapters
00:00 Question
00:32 Accepted answer (Score 145)
01:09 Answer 2 (Score 168)
01:33 Answer 3 (Score 61)
01:54 Answer 4 (Score 43)
02:10 Thank you
--
Full question
https://stackoverflow.com/questions/1534...
Accepted answer links:
[Pillow]: https://python-pillow.org/
[PIL]: http://www.pythonware.com/products/pil/
[the docs]: http://docs.scipy.org/doc/scipy/referenc...
Answer 2 links:
[imageio.imread]: http://imageio.github.io
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #installation #scipy #dependencies #pythonimaginglibrary
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops
--
Chapters
00:00 Question
00:32 Accepted answer (Score 145)
01:09 Answer 2 (Score 168)
01:33 Answer 3 (Score 61)
01:54 Answer 4 (Score 43)
02:10 Thank you
--
Full question
https://stackoverflow.com/questions/1534...
Accepted answer links:
[Pillow]: https://python-pillow.org/
[PIL]: http://www.pythonware.com/products/pil/
[the docs]: http://docs.scipy.org/doc/scipy/referenc...
Answer 2 links:
[imageio.imread]: http://imageio.github.io
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #installation #scipy #dependencies #pythonimaginglibrary
#avk47
ANSWER 1
Score 175
imread is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use imageio.imread instead.
import imageio
im = imageio.imread('astronaut.png')
im.shape # im is a numpy array
(512, 512, 3)
imageio.imwrite('imageio:astronaut-gray.jpg', im[:, :, 0])
ACCEPTED ANSWER
Score 146
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>
ANSWER 3
Score 62
imread is depreciated after version 1.2.0! So to solve this issue I had to install version 1.1.0.
pip install scipy==1.1.0
ANSWER 4
Score 44
For Python 3, it is best to use imread in matplotlib.pyplot:
from matplotlib.pyplot import imread