Im writing a script that takes 10k images from a folder and collages them into rows of 100. Each image is 32x32 pixels. This is the script I wrote:
import glob
from PIL import Image, ImageDraw
#creates an Image based on given pixel size
collage = Image.new("RGBA", (3200,3200), color=(255,255,255,255))
images = glob.glob("*.png")
for image in images:
img = Image.open(image)
x = img.convert("RGBA")
print(x)
#takes each image from the given directory above and merges it into a collage
for i in range(0,3200,32):
for j in range(0,3200,32):
img = images.pop()
collage.paste(img, (i,j))
#displays output of collage
collage.show()
#saves Image to given directory
collage.save(r"C:\Users\17379\Desktop\Nouns DAO\Noun assets\noun"+image)
But when I run it, I get this error:
ValueError: cannot determine region size; use 4-item box
What am I doing wrong?