Repository Public
1#!/usr/bin/env python32# Food-Ka iOS v23# File: Scripts/sheet.py4# Description: planche-contact de captures (pour les relire d'un coup). usage : sheet.py sortie.png colonnes img1 img2 …5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8import sys9from PIL import Image1011out, cols, files = sys.argv[1], int(sys.argv[2]), sys.argv[3:]12imgs = [Image.open(f).convert("RGB") for f in files]13w = 42014imgs = [i.resize((w, int(i.height * w / i.width))) for i in imgs]15h = max(i.height for i in imgs)16rows = (len(imgs) + cols - 1) // cols17sheet = Image.new("RGB", (cols * (w + 8) + 8, rows * (h + 8) + 8), (120, 120, 120))18for n, i in enumerate(imgs):19 sheet.paste(i, (8 + (n % cols) * (w + 8), 8 + (n // cols) * (h + 8)))20sheet.save(out)21print(out)22