python: convert base64 encoded png image to jpg

Viewed 11864

I want to convert some base64 encoded png images to jpg using python. I know how to decode from base64 back to raw:

import base64 
pngraw = base64.decodestring(png_b64text)

but how can I convert this now to jpg? Just writing pngraw to a file obviously only gives me a png file. I know I can use PIL, but HOW exactly would I do it? Thanks!

2 Answers
Related