我想生成一个从0到2500的束(x,y)坐标,它排除彼此在200之内的点而不递归.
现在我检查所有以前的值列表,看看是否有足够远的所有值.这是非常低效的,如果我需要生成大量的点,它需要永远.
那我该怎么做呢?
我想将一堆图像与PIL粘贴在一起.出于某种原因,当我运行该行时,blank.paste(img,(i*128,j*128))我收到以下错误:ValueError: cannot determine region size; use 4-item box
我试着弄乱它并使用一个像4所说的元素(例如(128,128,128,128)),但它给了我这个错误: 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')
Run Code Online (Sandbox Code Playgroud)
我怎样才能让它发挥作用?