Misc - Broken Pieces
479 points | 48 solves
Description
Downloads
Solution
from PIL import Image
# Since there are no dimensions specified and we are given 400 images,
# we assume it is a 20 by 20 square matrix. Hence, 15*20, 15*20.
src = Image.new('RGB', (300, 300))
for j in range(1,21):
for i in range(1,21):
dst = Image.open("pieces/" + str(i).zfill(2) + str(j).zfill(2) + ".jpg")
column = 1 if j == 1 else (j-1)*15
row = 1 if i == 1 else (i-1)*15
src.paste(dst, (column, row))
src.save('out.png')
Last updated
