Labels for CLARIDEN, FLORIDA, JUNGFRAU (gaps 06-20.10, 26.10-01.11), LENZSPITZE, NIEDERHORN, NORDEND, SNCF01, WILDSTRUBEL. Figures and tool outputs stay out of git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
786 B
Python
22 lines
786 B
Python
"""Recadre la même zone de plusieurs images et les met côte à côte. Usage: crop.py X0,Y0,X1,Y1 sortie.png HHMM_ids..."""
|
|
import sys, glob
|
|
from PIL import Image, ImageDraw
|
|
box = tuple(int(v) for v in sys.argv[1].split(","))
|
|
out = sys.argv[2]
|
|
tiles = []
|
|
for tag in sys.argv[3:]:
|
|
f = glob.glob(f"data/BREITHORN/images/{tag}*.jpg")[0]
|
|
im = Image.open(f).convert("L").crop(box)
|
|
im = im.point(lambda p: min(255, p * 3)) # même étirement pour toutes
|
|
d = ImageDraw.Draw(im)
|
|
d.text((5, 5), tag, fill=255)
|
|
tiles.append(im)
|
|
w, h = tiles[0].size
|
|
cols = min(4, len(tiles))
|
|
rows = (len(tiles) + cols - 1) // cols
|
|
sheet = Image.new("L", (w * cols, h * rows))
|
|
for i, t in enumerate(tiles):
|
|
sheet.paste(t, ((i % cols) * w, (i // cols) * h))
|
|
sheet.save(out)
|
|
print(out)
|