Etiqueteur: October labels for 8 stations; its folder moves to labeling/auto/etiqueteur/, analyses and scripts versioned (D-126)
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>
This commit is contained in:
1 parent
2bba388290
commit
6fbd7510b7
112 files changed
+8951
-6
No files matched your search
@@ -0,0 +1,21 @@
|
||||
"""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)
|
||||
Reference in new issue
Block a user