0
votes

I'm attempting to grab an image of diagrams constructed within a rectangle on a power point slide deck. I found python-pptx and am able to identify the shapes on each slide. Is there any way to expand this to take a snapshot of the area within the rectangle shape and export it as an image?

# Auto grab the photos created in Powerpoint

from pptx import Presentation

prs = Presentation('ex.pptx')

for slide in prs.slides:
    print(slide)
        for shape in slide.shapes:
            print(shape)
# Identify shape on each slide, find area within, and save as .png
1
What platform(s) does it need to run on? - scanny
This just needs to run on a Windows 10 machine - Marc Veihl

1 Answers

0
votes

I think you're going to be best off looking at a COM32 type of solution, either writing something in VBA or possibly using the win32com library in Python if you really want a Python solution.

Either way this is going to fire up a "live" PowerPoint application instance and basically run it by remote control. That sort of thing isn't a great idea server-side, but if it's just for personal productivity it might work fine.

python-pptx can't do this sort of thing and probably never will. The rendering engine needs to get involved in this type of work and python-pptx is strictly a .pptx file editor/generator.