我想将一堆图像与PIL一起粘贴。出于某种原因,当我运行线blank.paste(img,(i*128,j*128))
我得到以下错误:(EX(128128128128))ValueError: cannot determine region size; use 4-item box
Python PIL Paste
我试图与它搞乱,并使用一个元组有4个元素,比如它说,但它给了我这个错误: SystemError: new style getargs format but argument is not a tuple
每张图片都是128x,并且命名风格为“x_y.png”,其中x和y从0到39.我的代码如下。
from PIL import Image
loc = 'top right/'
blank = Image.new("RGB", (6000,6000), "white")
for x in range(40):
for y in reversed(range(40)):
file = str(x)+'_'+str(y)+'.png'
img = open(loc+file)
blank.paste(img,(x*128,y*128))
blank.save('top right.png')
我该如何得到这个工作?
这工作,谢谢。我知道这会是一件愚蠢的事情。 – user2901745
对于os.path.join建议+1。 – volvox