两个函数,用到Numpy模块和Image模块from PIL import Image import numpy as npim=np.array(Image.open('exam.jpg')) #打开图片并通过array转换为数组im=Image.fromarray(im) #变回图片