[英]PNG image wrongfully opened as RGB by pil.image
I have images like this , which I believe have 4 data channels (RGB + an alpha channel). 我有这样的图像此 ,我相信有4个数据通道(RGB + alpha通道)。
When I try to open this image like so, I can't access the transparency layer. 当我尝试像这样打开此图像时,我无法访问透明层。
from PIL import Image
fn = 'FUgqUA5.png'
im = Image.open(fn)
im.mode # returns RGB instead of desired .png
im.getData()[0] # returns (0,0,0) instead of desired (0,0,0,255)
How do I open this image as an actual .png
? 如何打开此图像作为实际的
.png
? Is it possible the image is saved as a 3-channel png
instead and that this image simply doesn't have a 4th channel? 图像是否可能另存为3通道
png
,并且该图像根本没有第4通道?
I saved the image and saw the properties via image editor and it did not mention that there is a 4th channel. 我保存了图像,并通过图像编辑器看到了属性,但没有提到有第四个通道。 PS: (image editor is ImageMagick )
PS :(图像编辑器是ImageMagick )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.