Python Insert Image into the middle of an existing PowerPoint

Viewed 9256

I have an existing PowerPoint presentation with 20 slides. This presentation serves as an template with each slide having different backgrounds. I want to take this (existing) PowerPoint presentation, insert an image in slide number 4 (do nothing with the first 3) and save it as a new PowerPoint presentation.

This is what I have up until now. This code loads an existing presentation and saves it as a new one. Now I just need to know how to use this to insert an image to slide number 4 like described above.

Note: I am using normal Python.

from pptx import Presentation

def open_PowerPoint_Presentation(oldFileName, newFileName):
    prs = Presentation(oldFileName)
    #Here I guess I need to type something to complete the task.
    prs.save(newFileName)

open_PowerPoint_Presentation('Template.pptx', 'NewTemplate.pptx')
1 Answers
Related