使用imageio时如何将图像打开为rgb文件

how to open image as rgb file when using imageio

我有一个现有代码段使用 scipy.misc

读取图像
imref = misc.imread(self.file_image, False, "RGB")

如果我想用imageio替换它,怎么办,我可以使用

imref = imageio.imread(self.file_image, False). 

我不清楚在使用 imageio.imread 时在哪里设置 "RGB" 参数。

docs 中所述,您可以使用关键字参数 pilmode 来指定模态,而 scipy flatten 将替换为 as_gray。所以在你的情况下:

imref = imageio.imread(self.file_image, as_gray=False, pilmode="RGB")

如果出现错误怎么办:"Imageio Pillow plugin requires Pillow lib"?