Convert Powerpoint PPT to JPG
Convert Presentation to Set of Images
In some cases, it is necessary to convert the entire presentation into a set of images, the same as PowerPoint allows. The C++ code shows you how to convert a presentation to JPG images:
auto imageScale = 1.0f;
auto pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.ppt");
for (auto&& slide : pres->get_Slides())
{
// Creates a full scale image
System::SharedPtr<IImage> image = slide->GetImage(imageScale, imageScale);
// Saves the image to disk in JPEG format
auto imageFileName = System::String::Format(u"Slide_{0}.jpg", slide->get_SlideNumber());
image->Save(imageFileName, ImageFormat::Jpeg);
image->Dispose();
}
pres->Dispose();
Convert PowerPoint PPT/PPTX to JPG with Customized Dimensions**
To change the dimension of the resulting thumbnail and JPG image, you can set the ScaleX and ScaleY values by passing them into float scaleX, float Y
of the ISlide::GetImage() method:
auto pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.pptx");
// Defines dimensions
int32_t desiredX = 1200, desiredY = 800;
// Gets scaled values of X and Y
float scaleX = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Width()) * desiredX;
float scaleY = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Height()) * desiredY;
for (auto&& slide : pres->get_Slides())
{
// Creates a full scale image
System::SharedPtr<IImage> image = slide->GetImage(scaleX, scaleY);
// Saves the image to disk in JPEG format
auto imageFileName = System::String::Format(u"Slide_{0}.jpg", slide->get_SlideNumber());
image->Save(imageFileName, ImageFormat::Jpeg);
image->Dispose();
}
pres->Dispose();
Tip
Aspose provides a FREE Collage web app. Using this online service, you can merge JPG to JPG or PNG to PNG images, create photo grids, and so on.
Using the same principles described in this article, you can convert images from one format to another. For more information, see these pages: convert image to JPG; convert JPG to image; convert JPG to PNG, convert PNG to JPG; convert PNG to SVG, convert SVG to PNG.
See also
See other options to convert PPT/PPTX into image like: