python将图片转为base64编码

import base64

f = open("m1.jpg", "rb")
res = f.read()
s = base64.b64encode(res)

f = open("hello.txt","w")
f.write(s)
原文地址:https://www.cnblogs.com/code-style/p/4042654.html