PIL Image.save() 转换不保持RGB颜色
PIL Image.save() convert does'nt maintain RGB color
我正在尝试使用 PIL.Image.save() 将 numpy 数组保存为 RGB 图像,但保存的图像不是 RGB。如何将图像保存为 RGB?我收到的图像是 numpy 数组。
image_with_detections = np.array(image_with_detections)
image = Image.fromarray(image_with_detections.astype('uint8'), 'RGB')
image.save(save_path)
原图link
link 到 Image.save()
保存的图像
您可以执行以下操作
image_with_detections = np.array(image_with_detections)
image = Image.fromarray(image_with_detections.astype('uint8'), 'RGB')
image = image[:,:,::-1]
image.save(save_path)
我正在尝试使用 PIL.Image.save() 将 numpy 数组保存为 RGB 图像,但保存的图像不是 RGB。如何将图像保存为 RGB?我收到的图像是 numpy 数组。
image_with_detections = np.array(image_with_detections)
image = Image.fromarray(image_with_detections.astype('uint8'), 'RGB')
image.save(save_path)
原图link link 到 Image.save()
保存的图像您可以执行以下操作
image_with_detections = np.array(image_with_detections)
image = Image.fromarray(image_with_detections.astype('uint8'), 'RGB')
image = image[:,:,::-1]
image.save(save_path)