#!/usr/bin/env python3 """Contact image of raws for a quick look: peek.py OUT RAW [RAW ...] (each scaled to 520 px high, side by side).""" import sys from PIL import Image H = 520 ims = [Image.open(p).convert("RGB") for p in sys.argv[2:]] ims = [i.resize((round(i.width * H / i.height), H), Image.LANCZOS) for i in ims] out = Image.new("RGB", (sum(i.width for i in ims) + 10 * (len(ims) - 1), H), (40, 40, 40)) x = 0 for i in ims: out.paste(i, (x, 0)) x += i.width + 10 out.save(sys.argv[1])