I want to insert a bunch of images along with PIL. For some reason, when I run the blank.paste(img,(i*128,j*128)) , I get the following error: ValueError: cannot determine region size; use 4-item box ValueError: cannot determine region size; use 4-item box
I tried messing with it and used a tuple with 4 elements like this (e.g. 128 1288 1288), but it gives me this error: SystemError: new style getargs format but argument is not a tuple
Each image is 128x in size and has a naming style of "x_y.png", where x and y are from 0 to 39. My code is below.
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')
How can I make this work?
source share