gok*_*pta 1 image python-2.7 pillow
我正在尝试用 PIL ImageDraw 绘制一个三角形,这是我拥有的代码
t1 = int(tri[0])
t2 = int(tri[1])
t3 = int(tri[2])
t4 = int(tri[3])
t5 = int(tri[4])
t6 = int(tri[5])
t7 = int(tri[6])
t8 = int(tri[7])
t9 = int(tri[8])
t10 = int(tri[9])
draw.polygon((t1,t2),(t3,t4),(t5,t6), fill=(t7,t8,t9,t10))
Run Code Online (Sandbox Code Playgroud)
我收到错误
类型错误:polygon() 为参数“fill”获得了多个值
有什么方法可以制作三角形而不会出现此错误
蟒蛇 2.7
Like this:
from PIL import Image,ImageDraw
# Create empty black canvas
im = Image.new('RGB', (255, 255))
# Draw red and yellow triangles on it and save
draw = ImageDraw.Draw(im)
draw.polygon([(20,10), (200, 200), (100,20)], fill = (255,0,0))
draw.polygon([(200,10), (200, 200), (150,50)], fill = 'yellow')
im.save('result.png')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4895 次 |
| 最近记录: |