Created
November 18, 2024 15:19
-
-
Save MartinWeiss12/46da885ad13d9b33a43c075774d7d09f to your computer and use it in GitHub Desktop.
Mini Grid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mini_grid(path, grid_type): | |
grid = Image.new('RGB', (8000, 8000)) | |
list = [f'{path}/{grid_type}-{i}.png' for i in range(1, 15)] | |
for i, img in enumerate(list, start=1): | |
if i == 1: | |
image = Image.open(img).resize((4000, 4000)) | |
grid.paste(image, (2000, 2000)) | |
if i >= 2 and i <= 4: | |
image = Image.open(img).resize((2000, 2000)) | |
grid.paste(image, (-4000 + (i * 2000), 0)) | |
if i >= 5 and i <= 8: | |
image = Image.open(img).resize((2000, 2000)) | |
grid.paste(image, (6000, -10000 + (i * 2000))) | |
if i >= 9 and i <= 11: | |
image = Image.open(img).resize((2000, 2000)) | |
grid.paste(image, (24000 - (i * 2000), 6000)) | |
if i >= 12 and i <= 14: | |
image = Image.open(img).resize((2000, 2000)) | |
grid.paste(image, (0, 30000 - (i * 2000))) | |
grid.save(f'{grid_type.lower()}-mini-grid.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment