Successfully installed SciPy, but "from scipy.misc import imread" gives ImportError: cannot import name 'imread'

Viewed 1879

I have successfully installed scipy, numpy, and pillow, however I get error as below

ImportError: cannot import name 'imread'

2 Answers

Are you following the same steps?

import scipy.misc
img = scipy.misc.imread('my_image_path')

# To verify image is read properly.
import matplotlib.pyplot as plt
print(img.shape)
plt.imshow(img)
plt.show()

imread and imsave are deprecated in scipy.misc

Use imageio.imread instead after import imageio.

For saving - Use imageio.imsave instead or use imageio.write

For resizing use skimage.transform.resize instead after import skimage

Related