指定一张图片,输出图片的base64码
import base64
with open("C:\\Users\\zy\\Desktop\\AI项目\\动物世界\\狗33\\狗2.jpg", 'rb') as file:
base64_data = base64.b64encode(file.read())
bs = base64_data.decode()
print('data:image/jpeg;base64,%s' % bs)
指定一张图片,输出图片的base64码
import base64
with open("C:\\Users\\zy\\Desktop\\AI项目\\动物世界\\狗33\\狗2.jpg", 'rb') as file:
base64_data = base64.b64encode(file.read())
bs = base64_data.decode()
print('data:image/jpeg;base64,%s' % bs)