python绘制图像的参数_图像绘制.draw.line():系统错误:新样式getargs格式,但参数不是tup...
我在這個(gè)問(wèn)題上看到了多個(gè)問(wèn)題,但沒(méi)能找到問(wèn)題的答案。基本上,我只想在圖像上畫(huà)一條線,從python中的外部文件中獲取坐標(biāo)。我的代碼是:import Image, ImageDraw
import sys
import csv
im = Image.open("screen.png")
draw = ImageDraw.Draw(im)
with open("outputfile.txt") as file:
reader = csv.reader(file, delimiter=' ')
for row in reader:
if row[0] == 'H':
print "Horizontal line"
endx = row[2]
endy = int(row[3])+int(row[1])
elif row[0] == 'V':
print "Vertical line"
endx = row[2]+row[1]
endy = row[3]
x = row[2]
y = row[3]
draw.line((x,y, endx,endy), fill = 1)
im.show()
除了臺(tái)詞,一切都正常:
^{pr2}$
我看到以下錯(cuò)誤:File "dummy_test.py", line 21, in
draw.line((x,y, endx,endy), fill = 1)
File "/Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.10- intel.egg/ImageDraw.py", line 200, in line
self.draw.draw_lines(xy, ink, width)
SystemError: new style getargs format but argument is not a tuple
如果我硬編碼這些值,我看不出問(wèn)題。問(wèn)題只發(fā)生在上述情況下。有人能指出問(wèn)題嗎?在
總結(jié)
以上是生活随笔為你收集整理的python绘制图像的参数_图像绘制.draw.line():系统错误:新样式getargs格式,但参数不是tup...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 关于vs2015各版本的卸载
- 下一篇: websocket python爬虫_p