Skip to content

Instantly share code, notes, and snippets.

@MartinWeiss12
Created November 18, 2024 15:18
Show Gist options
  • Save MartinWeiss12/3eca7c072a92271ee5f261ee2bc4a0fc to your computer and use it in GitHub Desktop.
Save MartinWeiss12/3eca7c072a92271ee5f261ee2bc4a0fc to your computer and use it in GitHub Desktop.
Full Grid
def full_grid(path, grid_type):
grid = Image.new('RGB', (8000, 8000))
list = [f'{path}/{grid_type}-{i}.png' for i in range(1, 50)]
for i, img in enumerate(list, start=1):
if i == 1:
image = Image.open(img).resize((3200, 3200))
grid.paste(image, (2400, 2400))
if i >= 2 and i <= 4:
image = Image.open(img).resize((1600, 1600))
grid.paste(image, (-2400+(i*1600), 800))
if i >= 5 and i <= 8:
image = Image.open(img).resize((1600, 1600))
grid.paste(image, (5600, -7200+(i*1600)))
if i >= 9 and i <= 11:
image = Image.open(img).resize((1600, 1600))
grid.paste(image, (18400-(i*1600), 5600))
if i >= 12 and i <= 13:
image = Image.open(img).resize((1600, 1600))
grid.paste(image, (800, 23200-(i*1600)))
if i >= 14 and i <= 23:
image = Image.open(img).resize((800, 800))
grid.paste(image, (-11200+(i*800), 0))
if i >= 24 and i <= 32:
image = Image.open(img).resize((800, 800))
grid.paste(image, (7200, -18400+(i*800)))
if i >= 33 and i <= 41:
image = Image.open(img).resize((800, 800))
grid.paste(image, (32800-(i*800), 7200))
if i >= 42 and i <= 49:
image = Image.open(img).resize((800, 800))
grid.paste(image, (0, 40000-(i*800)))
grid.save(f'{grid_type.lower()}-full-grid.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment