misc) Various utilities that don't have another home. Note that the Python Imaging Library (PIL) is not a dependency of SciPy and therefore the pilutil module is not available on systems that don't have PIL installed.
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])
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>
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
For Python 3, it is best to use imread
in matplotlib.pyplot
:
from matplotlib.pyplot import imread
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With