Created
September 3, 2025 16:15
-
-
Save yanndebray/5fa2f644173fbeba16566965a19e8db9 to your computer and use it in GitHub Desktop.
Revisions
-
yanndebray created this gist
Sep 3, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ #!/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()