Flo161 commited on
Commit
c994dc2
·
1 Parent(s): 77ec81d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -105,14 +105,14 @@ if uploaded_file is not None:
105
  # Create a slide
106
  slide = prs.slides.add_slide(prs.slide_layouts[5])
107
 
108
- # Add the image to the slide, centered and at the bottom (1 inch from the bottom)
109
- left = Inches(1)
110
- top = Inches(5) # Adjust the top position for centering
111
- width = height = Inches(5)
112
- pic = slide.shapes.add_picture(temp_img_path, left, top, width, height)
113
-
114
- # Center the image on the slide
115
- pic.left = (prs.slide_width - pic.width) / 2
116
 
117
  # Add the paragraph to the slide at the top
118
  left = Inches(1)
 
105
  # Create a slide
106
  slide = prs.slides.add_slide(prs.slide_layouts[5])
107
 
108
+ # Calculate centered position for the image at the bottom (1 inch from the bottom)
109
+ img_width = Inches(5)
110
+ img_height = Inches(5)
111
+ img_left = int((prs.slide_width - img_width).inches / 2)
112
+ img_top = int((prs.slide_height - img_height - Inches(1)).inches)
113
+
114
+ # Add the image to the slide
115
+ pic = slide.shapes.add_picture(temp_img_path, img_left, img_top, img_width, img_height)
116
 
117
  # Add the paragraph to the slide at the top
118
  left = Inches(1)