demo/python/image_create/image_create.py

8 lines
230 B
Python
Raw Permalink Normal View History

from PIL import Image
# 创建一个320x240的RGB图像填充为白色
image = Image.new('RGB', (320, 240), (255, 255, 255))
# 保存为JPEG格式设置压缩质量为50
image.save('output.jpg', 'JPEG', quality=50)