feat: narrower margins on landscape topology pages

- Landscape pages use 7 mm side margins (PDF) / 0.7 cm (Word) and
  compact headings, so the topology gets about 28 cm of width.
- Portrait pages after a landscape page restore their original margins.
- The topology PNG is cropped to its content, removing the blank border.

Bump version to 0.6.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 15:25:06 +02:00
co-authored by Claude Opus 5.5
parent e3c31b6312
commit bce880f5d7
5 changed files with 31 additions and 8 deletions
+8
View File
@@ -438,6 +438,14 @@ def render_png(graph, show_ports=False, scale=2):
for text, x, y, anchor in labels:
tag(text, x, y, anchor)
# weißen Rand abschneiden: jeder Millimeter kommt der Größe im Dokument zugute
from PIL import ImageChops
bbox = ImageChops.difference(img, Image.new("RGB", img.size, (255, 255, 255))).getbbox()
if bbox:
pad = 6 * S
img = img.crop((max(bbox[0] - pad, 0), max(bbox[1] - pad, 0), min(bbox[2] + pad, img.width), min(bbox[3] + pad, img.height)))
out = BytesIO()
img.save(out, "PNG", optimize=True)
return out.getvalue()