📅  最后修改于: 2022-03-11 14:46:10.537000             🧑  作者: Mango
import io
from PIL import Image
# Encode your PIL Image as a JPEG without writing to disk
buffer = io.BytesIO()
YourImage.save(buffer, format='JPEG', quality=75)
# You probably want
desiredObject = buffer.getbuffer()