文档首页> 人脸识别服务 FRS> 常见问题> API使用类> 如何获取图片的base64编码
更新时间:2023-10-18 GMT+08:00

如何获取图片的base64编码

本节以Python为例,介绍如何将本地图片,转换为base64编码。您也可以使用在线的图片转base64工具。

使用时,需要将代码的d:\demo.jpg替换为实际图片路径。

import base64
with open("d:\demo.jpg", "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read()).decode()
print(encoded_string)

API使用类 所有常见问题

more