Read and Modify a Linked Image Path in a PowerPoint Presentation in C#

Hi,

We have a use case, where we’d like to read and modify the path of linked images. I’ve looked at the documentation, but found nothing (except for OLE object links, which is not the case here). I’ve also checked this forum, but came up with only a handful of related posts suggesting that there is no support for it, though they are quite old (10+ years).

I’ve prepared a sample project listing all the images and shapes, along with some sample documents.
PptLinkedImageTest.zip (180.1 KB)

Those that contain regular images have the image data in Presentation.Images and a related object in Presentation.Slides[n].Shapes too. On the other hand, linked images only show up in Presentation.Slides[n].Shapes. I couldn’t find a way to match a shape with its related image data, or tell if it’s missing, as a result, I can’t even figure out which shape corresponds to a linked image and which one is embedded.

Have you implemented support for linked images since then?
If you did, could you please point me to the relevant part of the docs?
If not, have you considered supporting it, and do you happen to have a rough time frame?

Thanks in advance for your assistance!

Regards,
Peter

1 Like

@psimon,
Thank you for posting the questions. I am working on the issue and will get back to you soon.

@psimon,
I’m not quite sure I understand the issue you are facing. Could you please provide more details and explain how to reproduce it? Thank you for your patience.

Sure, no problem!
So basically I’m adding an image as a link to a presentation using e.g. PowerPoint 2016 with:

  • Insert/Pictures
  • Select the image
  • Add it using “Link to File” in the insert button’s drop-down menu

The project I attached contains such a presentation (see presentationWithLinkedImage.pptx).

My main issue is that I cannot access the link itself (and not the linked image). I’m expecting to see <somePath>\sampleImage.jpg using some property or method, and be able to read and modify it. Can that be done somehow?

@psimon,
Thank you for the details. I am working on the issue and will get back to you soon.

@psimon,
Aspose.Slides supports linked images. You can access them via the LinkPathLong property from the ISlidesPicture interface like this:

if (shape is IPictureFrame pictureFrame)
{
    var currentPath = pictureFrame.PictureFormat.Picture.LinkPathLong;
    pictureFrame.PictureFormat.Picture.LinkPathLong = newPath;
}

More examples:

This seems to do the trick. Thank you for pointing me in the right direction!

@psimon,
We are glad to know that the issue has been resolved on your end. Thank you for using Aspose.Slides.