from PIL import Image
img = Image.open("a.jpg")
import base64
with open("a.jpg", 'rb') as f:
base64_data = base64.b64encode(f.read())
s = base64_data.decode()
print('data:image/jpeg;base64,%s' % s)
Python获取图片base64位编码
最新推荐文章于 2024-06-04 05:44:20 发布