原生图像转base64
def get_img_base64str(single_image_path):
with open(single_image_path, 'rb') as fp:
imgbase64 = base64.b64encode(fp.read())
return imgbase64.decode()
base64转image.open
def stringToImage(base64_string):
imgdata = base64.b64decode(base64_string)
return Image.open(io.BytesIO(imgdata))