import PIL.Image as Image# 读取图像img = Image.open('img')img_np = np.array(img) # 使用Image.fromarray将NumPy数组转换为图像image = Image.fromarray(img_np) # 图像保存image.save('image.png')