PIL图像模式"P"

编程入门 行业动态 更新时间:2024-10-28 09:19:52
本文介绍了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"

推荐答案

在此报告了此问题:

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"

本文发布于:2023-06-08 15:36:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/583974.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   模式   PIL   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!