PIL Image mode "P" -> "RGBA"

mDroidd picture mDroidd · Sep 17, 2012 · Viewed 31.3k times · Source

This is my issue:

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?

Image: original

Result: result

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

Answer

jterrace picture jterrace · Sep 17, 2012

This issue was reported here:

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

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.