#!/usr/bin/env python
from PIL import Image

result = Image.new('RGB', (800, 600))

# Make the bigger squares and combine them on the result image
for i in range(4):
    subimage = Image.new('RGB', (400, 300))

    # Loop over all squares in directory
    for j in range(10000):
        subcol = j % 100
        subrow = j // 100
        with Image.open(f"{i}/square-{j}.png") as im:
            subimage.paste(im=im, box=(subcol*4, subrow*3))

    col = i % 2
    row = i // 2

    result.paste(im=subimage, box=(col*400, row*300))

result.save("flag.png", "PNG")
