python - How to convert base64 string to image? -


i'm converting image base64 string , sending android device server. now, need change string image , save in database.

any help?

try this:

import base64 imgdata = base64.b64decode(imgstring) filename = 'some_image.jpg'  # assume have way of picking unique filenames open(filename, 'wb') f:     f.write(imgdata) # f gets closed when exit statement # save value of filename database 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -