Animated GIF has the ability to contain a number of images in a single file. Therefore, PowerPoint presentations are often converted to GIF files where each image in the GIF represents a slide. To perform the conversion programmatically, this article covers how to convert a PowerPoint PPT or PPTX presentation to an animated GIF in Java. Furthermore, you will learn how to customize frame size, the delay between slides, and frames per second programmatically.
- Java API for PowerPoint to GIF Conversion
- Convert a PowerPoint PPT to GIF in Java
- Set Additional Options for PPT/PPTX to GIF Conversion
Java API for PowerPoint PPT to GIF Conversion
Aspose.Slides for Java is a feature-rich API for creating and manipulating PowerPoint presentations. Moreover, it provides high-fidelity conversion of PPT/PPTX files to other formats. We will use this API to convert PowerPoint PPT/PPTX files to animated GIFs. You can download API’s JAR or install it using the following Maven configurations.
Repository:
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
Dependency:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>22.2</version>
<classifier>jdk16</classifier>
</dependency>
Convert a PowerPoint PPT to GIF in Java
To convert a PPT/PPTX to GIF, you only need to load the presentation and save it as a GIF. The following are the steps to convert a PPT to GIF in Java.
- Load the PPT/PPTX presentation using Presentation class.
- Save the presentation as GIF using Presentation.save(string, SaveFormat.Gif) method.
The following code sample shows how to convert a PowerPoint PPTX file to an animated GIF in Java.
Set Additional Options – Java PPT to GIF
You can also customize PPT to GIF conversion using different options such as the delay between slides, frame size of GIF, and the transition in frames per second. The following are the steps to customize PPT to GIF conversion.
- Load the PPT/PPTX presentation using Presentation class.
- Create an instance of GifOptions class.
- Set desired options such as frame size.
- Save the presentation as GIF using Presentation.save(string, SaveFormat.Gif, GifOptions) method.
The following code sample shows how to convert a PPT to an animated GIF with customized settings in Java.
Get a Free License
You can get a free temporary license to use Aspose.Slides for Java without evaluation limitations.
Conclusion
In this article, you have learned how to convert PowerPoint PPT/PPTX presentations to animated GIF in Java. Furthermore, you have seen how to customize PowerPoint to GIF conversion using different options. Besides, you can explore more about Aspose.Slides for Java using the documentation. Also, you can post your queries to our forum.