This commit is contained in:
kim
2026-05-01 01:09:04 +09:00
parent fbaacc2e60
commit 6675779566
30 changed files with 177 additions and 14 deletions
+14 -9
View File
@@ -311,9 +311,11 @@ def set_slide_bg_image(slide, image_path: str):
fill = bg.fill
fill.background()
# python-pptx doesn't have a direct bg-image API — add a full-slide image instead
slide.shapes.add_picture(
pic = slide.shapes.add_picture(
image_path, Inches(0), Inches(0), SLIDE_W, SLIDE_H
)
# Tag so pptx_preview.py can distinguish skin backgrounds from content images
pic.name = "background_skin"
def add_shape_rect(slide, left, top, width, height, color_hex: str):
@@ -623,17 +625,20 @@ def make_image_slide(prs, slide_spec, project_dir, workspace_path, colors, warni
image_path = slide_spec.get("image_path")
if image_path:
resolved = resolve_image_path(image_path, project_dir, workspace_path)
# Image slides use full-slide bounding box with cover mode
# so photos completely fill the available area (cropping if needed)
# Add padding so the photo doesn't bleed edge-to-edge;
# use contain so the full photo is visible without cropping.
h_pad = Inches(0.5)
if has_title:
img_y = Inches(1.1)
max_h = SLIDE_H - Inches(1.1)
img_top = Inches(1.2)
v_pad = Inches(0.3)
else:
img_y = Inches(0)
max_h = SLIDE_H
img_top = Inches(0.4)
v_pad = Inches(0.4)
add_image_or_placeholder(slide, resolved,
Inches(0), img_y, SLIDE_W, max_h,
warnings, fit_mode="cover")
h_pad, img_top,
SLIDE_W - 2 * h_pad,
SLIDE_H - img_top - v_pad,
warnings, fit_mode="contain")
return slide