This commit is contained in:
kim
2026-04-29 23:16:01 +09:00
parent d89d7213f6
commit c348c9cbed
105 changed files with 212 additions and 201 deletions
+9 -9
View File
@@ -332,9 +332,9 @@ def fit_dimensions(img_w, img_h, max_w, max_h, mode="contain"):
mode='contain': fit entirely within max_w × max_h (default, no cropping)
mode='cover': fill max_w × max_h completely, cropping if necessary
"""
# Leave a small breathing margin inside the bounding box
max_w = int(max_w * 0.95)
max_h = int(max_h * 0.95)
# Tiny breathing margin — image fills nearly the full bounding box
max_w = int(max_w * 1.0)
max_h = int(max_h * 1.0)
if img_w <= 0 or img_h <= 0:
return max_w, max_h
ratio = img_w / img_h
@@ -493,17 +493,17 @@ def _text_weight(slide_spec: dict):
def _auto_text_ratio(slide_spec: dict) -> float:
"""Compute text column share (0–1) based on content volume.
≤2 bullets / ≤120 chars → 0.38 image-dominant
3–4 bullets / ≤280 chars → 0.50 balanced
5+ bullets / >280 chars → 0.62 text-dominant
≤2 bullets / ≤120 chars → 0.32 image-dominant
3–4 bullets / ≤280 chars → 0.44 balanced
5+ bullets / >280 chars → 0.56 text-dominant
"""
n_bullets, n_chars = _text_weight(slide_spec)
if n_bullets <= 2 and n_chars <= 120:
return 0.38
return 0.32
elif n_bullets <= 4 and n_chars <= 280:
return 0.50
return 0.44
else:
return 0.62
return 0.56
# ─── Slide Generators ──────────────────────────────────────────────────────────