How to Save a GIF Image from a PowerPoint Presentation as a GIF File in C++?

Hi Team,
I am using aspose slides for cpp. There is a gif image inserted in ppt. I want to be able to extract that picture as gif file. I have tried using IImage->Save(imagefilePath.gif); This seems to work for .png but doesnt work for .gif. I am getting only the screenshot of the gif.

Thanks

@pankajku,
Thank you for posting the question.

To extract a source GIF image from a PowerPoint presentation with Aspose.Slides for C++, you can use the IPictureFillFormat format. The following code example shows how to do this:

auto presentation = MakeObject<Presentation>(u"sample.pptx");
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shape(0);

if (ObjectExt::Is<IPictureFrame>(shape))
{
    auto pictureFrame = ExplicitCast<IPictureFrame>(shape);
    auto image = pictureFrame->get_PictureFormat()->get_Picture()->get_Image();
    if (image->get_ContentType().Equals(u"image/gif"))
    {
        auto imageStream = File::OpenWrite(u"output.gif");
        imageStream->Write(image->get_BinaryData(), 0, image->get_BinaryData()->Count());
        imageStream->Dispose();
    }
}

presentation->Dispose();

files.zip (316.1 KB)

Extracting Images from Presentation shapes|Aspose.Slides Documentation
Picture Frame|Aspose.Slides Documentation