#图片转base64
with open(r"C:\Every_day\python_learn\0429c.jpg","rb")as f:
bs64 = base64.b64encode(f.read()).decode()
print(bs64)
#base64转图片
with open(r"3.png","wb") as f:
f.write(base64.b64decode(bs64))
#图片转base64
with open(r"C:\Every_day\python_learn\0429c.jpg","rb")as f:
bs64 = base64.b64encode(f.read()).decode()
print(bs64)
#base64转图片
with open(r"3.png","wb") as f:
f.write(base64.b64decode(bs64))
本文标题:图片转base64
本文链接:https://www.haomeiwen.com/subject/yzjrmctx.html
网友评论