📜  如何在python代码示例中制作图像

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

代码示例1
#Here is an example of creating a flag:
from PIL import Image

def flag(c,w=100,h=100):
    c1,c2,c3 = c.split()
    img = Image.new("RGB", (w*3,h), c1)
    lay1 = Image.new("RGB", (w,h), c2)
    lay2 = Image.new("RGB", (w,h), c3)
    img.paste(lay1,(w,0))
    img.paste(lay2,(w*2,0))
    img.show()

flag("gold blue pink",200,350)