python实现图片转base64

import requests
import base64
from PIL import Image
from io import BytesIO

response = requests.get(image_url, headers=headers).content
image = Image.open(BytesIO(response))
base64_code = base64.b64encode(BytesIO(response).read())

你可能感兴趣的:(python)