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