Skip to content Skip to sidebar Skip to footer

Python Base64 String To PyPng Without Saving File

How do you do this without saving to disk and then opening 'out.png' ? r = requests.get(url) mine,encoded = r.json()[0]['data'].split(',') #if it is segmentation decod

Solution 1:

Use the bytes keyword

r = png.Reader(bytes=decoded)

Solution 2:

base53.decodestring() returns a string of the binary data, and according to this page png.Reader() can take a string as input, so you just have to link the two together.


Post a Comment for "Python Base64 String To PyPng Without Saving File"