With Aspose.Slides for 25.6, I used the following code example:
auto filePathTemplate = u"slide_{0}_shape_{1}_{2}.png"; // the third parameter is the shape name
auto presentation = MakeObject<Presentation>(u"Test1.pptx"); // and test1 (1) 2 copy.pptx, thumbnailPPT.pptx
try {
auto slideCount = presentation->get_Slides()->get_Count();
for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) {
auto slide = presentation->get_Slide(slideIndex);
auto shapeCount = slide->get_Shapes()->get_Count();
for (int shapeIndex = 0; shapeIndex < shapeCount; shapeIndex++) {
auto shape = slide->get_Shape(shapeIndex);
if (ObjectExt::Is<IAutoShape>(shape)) {
auto autoShape = ExplicitCast<IAutoShape>(shape);
auto shapeImage = autoShape->GetImage();
auto shapeName = autoShape->get_Name();
auto filePath = String::Format(filePathTemplate, slideIndex, shapeIndex, shapeName);
shapeImage->Save(filePath, ImageFormat::Png);
shapeImage->Dispose();
}
}
}
}
catch (const Exception& e) {
Console::WriteLine(e->get_Message());
}
presentation->Dispose();
The output images for the “Test1.pptx” file: Test1.pptx.output.zip (306.4 KB)
The output images for the “test1 (1) 2 copy.pptx” file: test1 (1) 2 copy.pptx.output.zip (9.5 KB)
The output images for the “thumbnailPPT.pptx” file: thumbnailPPT.pptx.output.zip (2.5 KB)