python绘制图像的参数_图像绘制.draw.line():系统错误:新样式getargs格式,但参数不是tup...
我在這個問題上看到了多個問題,但沒能找到問題的答案。基本上,我只想在圖像上畫一條線,從python中的外部文件中獲取坐標。我的代碼是: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()
除了臺詞,一切都正常:
^{pr2}$
我看到以下錯誤: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
如果我硬編碼這些值,我看不出問題。問題只發生在上述情況下。有人能指出問題嗎?在
總結
以上是生活随笔為你收集整理的python绘制图像的参数_图像绘制.draw.line():系统错误:新样式getargs格式,但参数不是tup...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于vs2015各版本的卸载
- 下一篇: tomcat日志详解