Welcome developer! you are hopefully here to programmatically convert some of your presentation slides to image formats. This could be needed when we want to share specific slide(s) as images or you want to create thumbnails from the presentations. In this article, you will learn how to convert the PPT or PPTX presentation slides into JPG and PNG images in Java.

Convert PPT to JPG or PNG Image in Java

The following topics are discussed here:

Java API to Convert Presentations

GroupDocs.Conversion provides Java API that allows conversion of presentations to images. Today, we will use its GroupDocs.Conversion for Java to convert the presentations of PPT & PPTX formats to JPG and PNG images. The API further supports many other conversions word-processing documents, spreadsheets, presentations, eBooks, images, and more that are mentioned in the documentation.

Download or Configure

You may download the JAR file from the downloads section, or just get the repository and dependency configurations for the pom.xml of your maven-based Java applications.

<repository>
	<id>GroupDocsJavaAPI</id>
	<name>GroupDocs Java API</name>
	<url>http://repository.groupdocs.com/repo/</url>
</repository>
<dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-conversion</artifactId>
        <version>21.10.1</version> 
</dependency>

Convert Presentation to JPG Image in Java

Let’s achieve the objective by transforming the presentation to JPG image format. The following steps guide how to convert the Powerpoint PPT/PPTX to JPG image format in Java.

  • Load the presentation using the Converter class.
  • Prepare the Image Convert Options.
  • Define the conversion file format as JPG.
  • Provide the slide number to convert.
  • Convert the presentation slide to JPG image using the convert() method.

The following Java source code converts the PowerPoint presentation to JPG format.

Convert Presentation to PNG Image in Java

Similarly, you can convert to other popular image formats like PNG. Let’s convert any slide of the presentation to PNG. The following steps show how to convert the PPT/PPTX presentation slide to PNG image format in Java.

  • Load the presentation file using Converter class.
  • Prepare the Image Convert Options.
  • Set the conversion file format as PNG.
  • Define the selected slides number to convert.
  • Convert the slide to PNG image using the convert() method.

The following Java source code example converts the PowerPoint presentation to PNG format.

Convert to Image with Effects

While converting the slides you can apply many variations to the output image file. You can learn more from any of the following articles:

Get a Free API License

You can get a free temporary license to use the API without the evaluation limitations.

Conclusion

To conclude we learned how presentation slides can be converted to JPG and PNG Images in Java. To build your conversion applications, you may learn more from the documentation and from the running examples on GitHub. Contact us for any query via the forum.

See Also