PIL图像模式"P" -> "RGBA" [英] PIL Image mode "P" -> "RGBA"

查看:203
本文介绍了PIL图像模式"P" -> "RGBA"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:

import Image
im = Image.open("1.png")
im.show()
print im.mode
im.convert("RGBA").save("2.png")

好吧,用我的图片,您可以看到不同之处.
我的问题是:如何正确转换?

Well, with my image you can see the difference.
My question is: how do I convert it properly?

图片:

结果:

注意:原始图像具有半透明的辉光,结果具有稳定的绿色辉光"

NOTE: The original image has a semi-transparent glow, the result has a solid green "glow"

推荐答案

在此报告了此问题:

https://bitbucket. org/effbot/pil-2009-raclette/issue/8/corrupting-images-in-palette-mode

2012年3月,有评论说它已经在PIL的开发版本中得到修复.最新发布的版本是1.1.7,因此该修补程序要等到1.2发行后才可用. PIL更新非常的速度很慢,所以不要指望很快就会出现.

In March 2012, a comment says it's now fixed in development version of PIL. The most recent released version is 1.1.7, so the fix won't be available until 1.2 comes out. PIL updates very slowly, so don't expect this to come out soon.

这篇关于PIL图像模式"P" -> "RGBA"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆