Google-app-engine – How Do I Convert Palette-Based PNG with Transparency To RGB in PIL

google-app-enginegoogle-cloud-storageimagepngpython-imaging-library

I'm currently building a site in app engine that uploads images to google cloud storage and to complete basic manipulations I'm using python's PIL

I've been having problems with the following image which another stackoverflow member has mentioned is a palette-based PNG with transparency, which I've been reading may be a bit buggy in PIL

enter image description here

My question is really a back to basics one: What is the best way to convert this to an RGB format with transparent pixels set to #FFF? I've been able to get it to work through a combined RGBA then RGB paste but that seems redundant

However, for a direct conversion I'm getting a bad transparency mask i.e. using the solution from PIL Convert PNG or GIF with Transparency to JPG without

Also if anybody has ideas why the image degrades to terrible quality after conversion, that's entirely a bonus for me!

enter image description here

Best Answer

A way to do this is to first convert the file to jpg -- seems like a problem with the png encoding (or something related to that)