获取图像模式 PIL Python
Get image mode PIL Python
我正在尝试将两张图片混合在一起,但我一直收到错误消息,其中一张图片的模式错误。我尝试转换此图像,但我尝试过的每种模式都只会使整个图像变白。 Python 有没有办法用 PIL 模块找出当前图像模式是什么?
Image.blend(img ,im ,0.05)
错误信息:
ValueError: image has wrong mode
参见文档中的Image Attributes:
Image.mode
: str
Image mode. This is a string specifying the pixel format used by the image. Typical values are '1'
, 'L'
, 'RGB'
, or 'CMYK'
. See Modes for a full list.
Image.convert
方法从现有图像创建具有给定 mode
的新 Image
。
我正在尝试将两张图片混合在一起,但我一直收到错误消息,其中一张图片的模式错误。我尝试转换此图像,但我尝试过的每种模式都只会使整个图像变白。 Python 有没有办法用 PIL 模块找出当前图像模式是什么?
Image.blend(img ,im ,0.05)
错误信息:
ValueError: image has wrong mode
参见文档中的Image Attributes:
Image.mode
:str
Image mode. This is a string specifying the pixel format used by the image. Typical values are
'1'
,'L'
,'RGB'
, or'CMYK'
. See Modes for a full list.
Image.convert
方法从现有图像创建具有给定 mode
的新 Image
。