获取图像模式PIL Python

2024-06-11 17:26:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着把两个图像混合在一起,但我一直得到一个错误,其中一个图像在错误的模式。我试图转换这个图像,但我尝试过的每一种模式都会使整个图像变成白色。Python中是否有方法使用PIL模块来找出当前的图像模式?

Image.blend(img ,im ,0.05)

错误消息: ValueError: image has wrong mode


Tags: 模块方法图像image消息imgpil错误
1条回答
网友
1楼 · 发布于 2024-06-11 17:26:43

请参阅文档中的Image Attributes

im.modestring

Image mode. This is a string specifying the pixel format used by the image. Typical values are '1', 'L', 'RGB', or 'CMYK.' See Concepts for a full list.

^{}方法从现有图像创建具有给定mode的新Image

相关问题 更多 >