Microsoft PowerPoint is a powerful and feature-rich software that allows you to create beautiful slides to use in your meetings. Even though PowerPoint is great for presentation purposes, it is not ideal for displaying content on the web, especially if the content is for information purposes only. For this, the better option would be to convert the PPTX files to images such as JPEG or PNG. In this article, you will learn how to convert PowerPoint to JPG programmatically using C++.
- C++ API for Converting PowerPoint to JPG
- Convert PowerPoint to JPG with Custom Image Dimensions
- Get a Free License
C++ API for Converting PowerPoint to JPG
Aspose.Slides for C++ is a feature-rich API that allows you to create and change PowerPoint files without requiring Microsoft PowerPoint. Furthermore, the API supports converting PowerPoint slides to JPG images. You can either install the API through NuGet or download it directly from the Downloads section.
PM> Install-Package Aspose.Slides.Cpp
Convert PPTX to JPG using C++
The following are the steps to convert PowerPoint files to JPG images.
- Load the PPTX file using the Presentation class.
- Retrieve the slides using the Presentation->get_Slides() method and iterate over them.
- Get the slide’s image using the ISlide->GetThumbnail (float scaleX, float scaleY) method and assign it to a Bitmap object.
- Save the image using the Bitmap->Save (const String & filename, const Imaging::ImageFormatPtr & format) method.
The following is the sample code to convert PPTX files to JPG images using C++
Source PowerPoint File
Converted JPG Images
Convert PowerPoint to JPG with Custom Image Dimensions
With Aspose.Slides for C++, you can customize the dimensions of the generated images according to your requirements. The following are the steps to convert PowerPoint slides to JPG images with custom dimensions.
- Load the PPTX file using the Presentation class.
- Specify the scaling values for the x-axis and y-axis using the slide’s width and height, respectively.
- Retrieve the slides using the Presentation->get_Slides() method and iterate over them.
- Get the slide’s image using the ISlide->GetThumbnail (float scaleX, float scaleY) method and assign it to a Bitmap object.
- Save the image using the Bitmap->Save (const String & filename, const Imaging::ImageFormatPtr & format) method.
The following is the sample code for converting PowerPoint presentations to JPG images with custom dimensions.
Get a Free License
You can try the API without evaluation limitations by requesting a free temporary license.
Conclusion
In this article, you have learned how to convert PowerPoint slides to JPG images using C++. Furthermore, you saw how to provide custom dimensions for the generated images. Aspose.Slides for C++ offers many other features for working with PowerPoint files. You can explore the API in detail by using the official documentation. If you have any questions, please feel free to contact us on the forum.
See Also
Tip: Aspose online PowerPoint to JPG converter is a live implementation of the PowerPoint to JPG conversion process, so you will do well to check it out.