Convert PowerPoint Presentations to Animated GIFs in Python

Overview

Aspose.Slides for Python via Java allows you to convert PowerPoint presentations to animated GIF files with just a few lines of code. This is useful for sharing slide content in web pages, messengers, or documentation. This article explains how to export a presentation using default settings and how to customize frame size, slide delay, and transition frame rate through GifOptions.

Convert Presentations to Animated GIF Using Default Settings

The following Python example loads pres.pptx and saves it as an animated GIF using standard settings:

import jpype
import asposeslides

if not jpype.isJVMStarted():
    jpype.startJVM()

from asposeslides.api import Presentation, SaveFormat

presentation = Presentation("pres.pptx")
try:
    presentation.save("pres.gif", SaveFormat.Gif)
finally:
    presentation.dispose()

Convert Presentations to Animated GIF Using Custom Settings

Use setFrameSize to specify the output dimensions in pixels, setDefaultDelay to set the default slide delay in milliseconds, and setTransitionFps to control the transition frame rate.

The following example exports a 960 × 720 GIF with a default slide delay of two seconds and 35 frames per second for transitions. The default delay applies when the slide’s advance-after time is not set.

import jpype
import asposeslides

if not jpype.isJVMStarted():
    jpype.startJVM()

from asposeslides.api import GifOptions, Presentation, SaveFormat

Dimension = jpype.JClass("java.awt.Dimension")

presentation = Presentation("pres.pptx")
try:
    gif_options = GifOptions()
    frame_size = Dimension(960, 720)
    gif_options.setFrameSize(frame_size)
    gif_options.setDefaultDelay(2000)
    gif_options.setTransitionFps(35)

    presentation.save("pres.gif", SaveFormat.Gif, gif_options)
finally:
    presentation.dispose()

FAQ

What if the fonts used in the presentation are not installed on the system?

Install the missing fonts or configure fallback fonts. Font substitution can change the appearance of the exported GIF. Make the original fonts available when matching the presentation’s design is essential.

Can I overlay a watermark on the GIF frames?

Yes. Add a semi-transparent object or logo to the relevant master slides or to individual slides before export. The watermark becomes part of the rendered slide content.