📜  我保存到字节 io python 代码示例

📅  最后修改于: 2022-03-11 14:46:26.451000             🧑  作者: Mango

代码示例1
from io import BytesIO
from PIL import Image, ImageDraw

image = Image.new("RGB", (300, 50))
draw = ImageDraw.Draw(image)
draw.text((0, 0), "This text is drawn on image")

byte_io = BytesIO()

image.save(byte_io, 'PNG')