from pathlib import Path
from PIL import Image, ImageDraw

root = Path(__file__).resolve().parent / 'inputs' / '素材'
root.mkdir(parents=True, exist_ok=True)
for index in range(1, 51):
    width, height = [(320, 200), (180, 300), (256, 256), (400, 160), (160, 400)][(index - 1) % 5]
    image = Image.new('RGB', (width, height), (40 + index * 3 % 170, 70 + index * 5 % 150, 90 + index * 7 % 140))
    drawing = ImageDraw.Draw(image)
    drawing.rectangle((15, 15, width - 16, height - 16), outline='white', width=4)
    drawing.text((width // 3, height // 2), f'IMAGE {index:02d}', fill='white')
    destination = root / f'{index:02d}-几何 图.png'
    if destination.exists():
        raise FileExistsError(f'保留已有原件，不覆盖：{destination}')
    image.save(destination)
