【发布时间】:2018-10-22 08:10:46
【问题描述】:
我一直在用 PIL 在 python 中搞乱,我正在研究一个在 4 个象限中镜像和成像的函数。显然我有一个错误,我似乎无法弄清楚。我的功能如下:
def mirror_four(image):
x = image.size[0]
y = image.size[1]
temp = Image.new("RGB", (image.size[0], image.size[1]), "black")
tl = image
tr = mirror_left(image)
bl = mirror_verticle(image)
br = mirror_verticle(tr)
image.paste(temp,(0,0,int(x/2),int(y/2)),tl)
image.paste(temp,(int(x/2),0,0,int(y/2)),tr)
image.paste(temp,(0,int(y/2),int(x/2),0),bl)
image.paste(temp,(x/2,y/2,x,y),br)
return temp
这会返回错误:ValueError: Images do not match
我有点迷茫,PIL 文档对我帮助不大。提前感谢您的帮助!
【问题讨论】:
-
你发现了吗?我遇到了类似的问题,但无法弄清楚。
标签: python image python-imaging-library valueerror