python PIL生成图片

from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw

#图片颜色
color = [random.randint(0, 255),random.randint(0, 255),random.randint(0, 255)]
# 生成背景图片
image = Image.new('RGB', (1080, 1920), (color[0],color[1],color[2]))
#在图片上留白 x开始位置 y开始位置 x结束位置  y结束位置
image.paste((255, 255, 255), (0, 1290, 1080 , 1410))
# 保存原始版本
image.save("12312.png")

猜你喜欢

转载自www.cnblogs.com/chenlizhi/p/13168454.html