python实现图片转base64

import requests import base64 from PIL import Image from io import BytesIOresponse = requests.get(image_url, headers=headers).content image = Image.open(BytesIO(response)) base64_code = base64.b64encode(BytesIO(response).read())

    推荐阅读