Example of how to convert a base64 image in png format using python (the input file base64.txt used in the following example can be found here):
import base64
from PIL import Image
from io import BytesIO
f = open('base64.txt', 'r')
data = f.read()
f.closed
im = Image.open(BytesIO(base64.b64decode(data)))
im.save('image.png', 'PNG')
returns:
References
Links | Site |
---|---|
Base64 | wikipedia |
Convert string in base64 to image and save on filesystem in Python | stackoverflow |
python: convert base64 encoded png image to jpg | stackoverflow |
Numpy Array to base64 and back to Numpy Array - Python | stack overflow |
sketch | sketch |