Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Last active August 11, 2021 17:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiolucero/2af21972ed514cffcba6d4580721f076 to your computer and use it in GitHub Desktop.
Save sergiolucero/2af21972ed514cffcba6d4580721f076 to your computer and use it in GitHub Desktop.
PPT compiler
from pptx import Presentation
from pptx.util import Inches
import glob
SLIDE_LAYOUT_TITLE_AND_CONTENT = 1
FILTER = 'fotos/*.jpg' # what to include
prs = Presentation()
slide_layout = prs.slide_layouts[SLIDE_LAYOUT_TITLE_AND_CONTENT]
for fn in glob.glob(FILTER):
slide = prs.slides.add_slide(slide_layout)
slide.shapes.add_picture(fn, Inches(1), Inches(1))
prs.save('compilado.pptx')
@sergiolucero
Copy link
Author

slide.shapes.add_picture(fn, Inches(0), Inches(0),
width=pptx.util.Inches(12), height=pptx.util.Inches(8))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment