According to the doc, scipy.misc.imread
is deprecated starting SciPy 1.0.0, and will be removed in 1.2.0. Consider using imageio.imread
instead.
Example:
import imageio
im = imageio.imread('my_image.png')
print(im.shape)
You can also use imageio to load from fancy sources:
im = imageio.imread('http://upload.wikimedia.org/wikipedia/commons/d/de/Wikipedia_Logo_1.0.png')
Edit:
To load all of the *.png
files in a specific folder, you could use the glob
package:
import imageio
import glob
for im_path in glob.glob("path/to/folder/*.png"):
im = imageio.imread(im_path)
print(im.shape)
# do whatever with the image here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…