Created
October 30, 2016 03:38
-
-
Save discentem/c2c07adb93e95f3e1e61a75b26a39a62 to your computer and use it in GitHub Desktop.
This file contains 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 characters
import os | |
import sys | |
from pptx import Presentation | |
from pptx.util import Inches | |
def get_pictures(full_path): | |
return [f for f in os.listdir(full_path) if f.endswith('.jpg')] | |
def place_pics_on_sep_slides(directory): | |
prs = Presentation() | |
blank_slide_layout = prs.slide_layouts[6] | |
pictures = get_pictures(directory) | |
print(pictures) | |
for pic in pictures: | |
slide = prs.slides.add_slide(blank_slide_layout) | |
left = top = Inches(1) | |
height = Inches(5.5) | |
pic = slide.shapes.add_picture(pic, left, top, height=height) | |
prs.save('test.pptx') | |
place_pics_on_sep_slides(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment