demo/python/image_create/image_create.py

8 lines
230 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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