PIL
pil=Image.open('D:/100.jpg').convert('L')
#PIL image转换为array
img1=np.asarray(img)
#修改图片的读取格式
img1.flags.writeable=True #将数组改写为读写模式
img1=img1.astype(np.float)
img=Image.fromarray(np.uint8(img1))
img.show()

浙公网安备 33010602011771号