How to programmatically update a logo on the first slide of a PowerPoint presentation using Python and python-pptx?

65 Views Asked by At

I'm working on a Python script using the python-pptx library to update the content of a PowerPoint presentation.

However, I also need to update the logo located on the first slide. The logo should be replaced programmatically, and it should remain in its fixed position without any possibility of being moved. Can someone guide me on how to achieve this using the python-pptx library or any other suitable approach in Python?

I attached photo to show you that the existing logo is not markable, so I can not move it, mark it, and so on, it is like a permanent.

You can see that the logo can not be marked, moved and so on.

I have successfully updated the title and subtitle of the first slide using the following code:

def update_presentation(presentation_path):
    # Open the presentation
    presentation = Presentation(presentation_path)

    # Update the title of the first slide
    first_slide = presentation.slides[0]
    title = first_slide.shapes.title
    title.text = "New Title"
    
    subtitle = first_slide.placeholders[1]  # Assuming the subtitle is the second placeholder
    subtitle.text = "New Subtitle"

0

There are 0 best solutions below