https://www.jianshu.com/p/570c1acdd236
from PIL import Image
import numpy as np
import base64
import io
IMAGE_PATH = "f:/img_414.jpg"
image = open(IMAGE_PATH,"rb").read() #图片转化为二进制
print(io.BytesIO(image)) #内存中读取二进制文件
image = Image.open(io.BytesIO(image)) #二进制转码为图片
image = image.resize((224,224))
image = np.asarray(image,dtype=np.float32)
image = np.expand_dims(image,axis=0)
print(image.shape)
image = base64.b64decode(image)
print(type(image))
image = bytes(image)
image = np.frombuffer(base64.decodebytes(image))
print(image.shape)