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