#!/usr/bin/env python3
import os
from PIL import Image
WS = "/home/mantapman/.hermes/profiles/atun/workspace"
SRC = os.path.join(WS, "studiosoft_hc64_carousel")
OUT = os.path.join(WS, "studiosoft_hc64_contact_sheet.jpg")
files = sorted(f for f in os.listdir(SRC) if f.startswith("ss_hc64_") and f.endswith(".png"))
ims = [Image.open(os.path.join(SRC, f)).convert("RGB").resize((432, 540)) for f in files]
W = 432 * 3
H = 540 * 2
sheet = Image.new("RGB", (W, H), (255, 255, 255))
for i, im in enumerate(ims):
    sheet.paste(im, ((i % 3) * 432, (i // 3) * 540))
sheet.save(OUT, "JPEG", quality=88)
print(OUT, sheet.size)
