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!
You can use PIL:
In very old Python versions (2.5 and older), replace
b'''with'''andfrom io import BytesIOwithfrom StringIO import StringIO.