We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to convert an embedded image in a slide to Shapes?

Hi,

Please find the attached powerpoint document and the screenshot.
For Support.zip (247.8 KB)

We are trying to convert an image into a set of editable objects/text’s. Basically if you open the powerpoint file and open the first slide which says “Table Of Contents”. It’s actually inserted as image while constructing the powerpoint. But now we are trying to hyperlink the individual row items in the slide. But since it is an image we are not able to do so from code.

But when you open the power point file and right click on the first slide, it actually gives an option “Edit Picture” (refer attached screenshot"). So after clicking on “Edit Picture” option it basically converts the image into an Mircorsoft Drawing object where each of the text lines becomes editable.

So, please let us know, if we can do the same using Aspose.Slides assembly? If so please let us know the details

Note: We are aware that we can write those text lines and then hyperlink them, but as of now we need to use the image only as it is provided by our GrapeCity-ActiveReport template… So if somehow we can convert that image into an editable object just like we do in powerpoint UI(refer screenshot), then we hope we can find those text lines/shapes and hyper link them.

Thanks in Advance,
Prathap

@PrathapSV,
Thank you for the issue description. The images you described are EMF images. Unfortunately, Aspose.Slides hasn’t ability to edit them. But as a workaround, please consider the next way:

  1. You can extract these images as shown below:
using (var presentation = new Presentation(dataPath + "1-psv-PPTx-Book-Test-PPTX-OutputType-DONOT-MODIFY@2099.pptx"))
{
    var shapes = presentation.Slides[0].Shapes;
    foreach (var shape in shapes)
    {
        if (shape is IPictureFrame pictureFrame)
        {
            var image = pictureFrame.PictureFormat.Picture.Image;
            if (image.ContentType == "image/x-emf")
            {
                using (var imageStream = new MemoryStream())
                {
                    imageStream.Write(image.BinaryData, 0, image.BinaryData.Length);
                    // ...
                }
            }
        }
    }
}
  1. You could change the extracted EMF images by using Aspose.Imaging. You can find out how to do it on Aspose.Imaging Product Family forum.

API Reference: PictureFrame Class