人证核身服务 IVS-通过python将图片转成base64编码

时间:2025-02-12 14:52:52

通过python将图片转成base64编码

下方示例代码以Python为例,介绍如何将d:\demo.jpg图片转换成base64编码。您也可以使用在线的图片转base64工具。

import base64with open("d:\demo.jpg", "rb") as image_file:    encoded_string = base64.b64encode(image_file.read()).decode()print(encoded_string)
support.huaweicloud.com/ivs_faq/ivs_03_0017.html
提示

您即将访问非华为云网站,请注意账号财产安全