Replace Image in Picture Frame

Hi,


I have a template presentation with a Picture Frame placeholder. I want to replace the image in the picture frame with a new image. I am able to create the image and add it to the presentation. I am also able to find the existing picture frame in the presentation. However, I don’t see a way to put my new image in the existing frame. Can you please help?

Thanks,

Scott

Hi Scott,

I have observed your requirements of setting new image to shape. Aspose.Slides offers you to add new image in presentation image collection and set the new image to picture frames. It also offers you to replace the image inside picture collection as well. When you replace the image inside picture collection, it will change the image in all presentation shapes where that same image has been referred. Please visit this link to see how to set the picture frame image. Please visit this link to see how to replace image in collection.

I hope the shared information will be helpful. Please share if I may help you further in this regard.

Many Thanks,

Hi,

Thanks for the information. I am now able to replace the picture. However, I must make an assumption on the index of the picture in the collection as I am not seeing where to pull it from the PictureFrame. This is what I have a reference to. Can you please let me know how to get the index of the image in the collection given a reference to a PictureFrame?

Thanks,

Scott

Hi Scott,

I like to share that PictureFrame contains the PPImage object instead its index. With this image you can find the image index inside Presentation.Images collection and then replace the image. I hope this will clarify the concept. Please share if I may help you further in this regard.

Many Thanks,

What is the method or property on the picture frame that will get me a reverence to the PPImage?

Hi Scott,


I have observed your requirements and suggest you to please try using following sample code on your end.

IPPImage addedImage = picFrm.PictureFormat.Picture.Image;

Many Thanks,