Skip to content

Advice on programming replace embededd image with a link #806

@TerryHewitt

Description

@TerryHewitt

I want to replace an embedded image with a link.
I can find the embedded image.
I can generate a new rId:
relationships = self.slide._part.rels
reltype = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'
newrId = relationships._add_relationship(reltype, newfilename, True)
let's say it generates 'rId3'

It seems there are two ways to the next bit:
A) edit the xml of a pptx.shapes.picture object to change: <a:blip r:embed="rId2"> to <a:blip r:link="rId3">
or
B) delete the old image and insert a 'linked image'

I know how to change the size and position to adjust for different aspect ratios.

I'm at a loss about how to do the detail of either A) or B). Could someone provide some code snippets or guidance please?

Best wishes
Terry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions