凌的博客

您现在的位置是: 首页 > 学无止境 > python > 

python

python 图片转base64

2020-03-07 python 927
def img2base64(imgpath):
    with open(imgpath, "rb") as f:
        base64_data = base64.b64encode(f.read())
        s = base64_data.decode()
        print("data:image/png;base64,%s" % s)


文章评论

0条评论