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 pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.ppt");

for (auto&& sld : pres->get_Slides())
{
    // Creates a full scale image
    System::SharedPtr<IImage> image = sld->GetImage(1.0f, 1.0f);

    // Saves the image to disk in JPEG format
    image->Save(System::String::Format(u"Slide_{0}.jpg", sld->get_SlideNumber()),
                ImageFormat::Jpeg);
}

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&& sld : pres->get_Slides())
{
    // Creates a full scale image
    System::SharedPtr<IImage> image = sld->GetImage(ScaleX, ScaleY);

    // Saves the image to disk in JPEG format
    image->Save(System::String::Format(u"Slide_{0}.jpg", sld->get_SlideNumber()),
                ImageFormat::Jpeg);
}

See also

See other options to convert PPT/PPTX into image like: