ValueError: Could not find a format to read the specified file in mode 'i'

报错:ValueError: Could not find a format to read the specified file in mode 'i’的解决方法

报错:AttributeError: ‘JpegImageFile’ object has no attribute 'shape’的解决方法

读取图片的三种方式

方式一:

import scipy.misc
img=scipy.misc.imread(’*.jpg’)
(注释:由于scipy.misc要被裁掉,所以引用第二种方式进行图片的读取)

方式二:

import imageio
img=imageio.imread(’*.jpg’)
(引用第二种图片读取方式时报错:ValueError: Could not find a format to read the specified file in mode ‘i’,改为第三种方式读取图片)

方式三:

import Image
img=Image.open(’*.jpg’)
(引用第三种方式读取图片,报错:AttributeError: ‘JpegImageFile’ object has no attribute ‘shape’,将图片转换为数组类型)
img=nd.array(img)

你可能感兴趣的:(ValueError: Could not find a format to read the specified file in mode 'i')