Skip to content

Instantly share code, notes, and snippets.

@yanndebray
Created September 3, 2025 16:15
Show Gist options
  • Save yanndebray/5fa2f644173fbeba16566965a19e8db9 to your computer and use it in GitHub Desktop.
Save yanndebray/5fa2f644173fbeba16566965a19e8db9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
"""
Create a PowerPoint deck from a folder of images, widescreen (16:9).
Usage:
python make_ppt.py --images slides/ --out slides.pptx
"""
import argparse
from pathlib import Path
from pptx import Presentation
from pptx.util import Inches
def make_ppt(images_folder, out_file):
prs = Presentation()
# Set to 16:9 format (13.33 x 7.5 inches)
prs.slide_width = Inches(13.33)
prs.slide_height = Inches(7.5)
blank_layout = prs.slide_layouts[6] # empty slide
# sort images by filename so slides are in order
image_files = sorted(Path(images_folder).glob("*.jpg"))
if not image_files:
raise RuntimeError(f"No images found in {images_folder}")
for img_path in image_files:
slide = prs.slides.add_slide(blank_layout)
# Place image to fill the entire slide
left = top = Inches(0)
slide.shapes.add_picture(
str(img_path), left, top,
width=prs.slide_width,
height=prs.slide_height
)
prs.save(out_file)
print(f"[✓] Saved {len(image_files)} slides to {out_file} (16:9 format)")
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--images", required=True, help="Folder with images (e.g. slides/)")
ap.add_argument("--out", required=True, help="Output .pptx file")
args = ap.parse_args()
make_ppt(args.images, args.out)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment