This simple how-to topic focuses on how to create PowerPoint slide Image using Python without any dependence on MS PowerPoint. It includes all necessary configuration steps and a working code example to generate image from PowerPoint slide in Python. This sample application can be used in any of .NET Core supported platforms configured with Python.
Steps to Create PowerPoint Slide image using Python
- Set up the environment to install Aspose.Slides for Python via .NET in your application
- Import aspose.slides and aspose.pydrawing in your Python file
- Open the source presentation file using the Presentation class object to create the slide thumbnail image
- Load the first slide inside the presentation slides collection
- Add the user defined X and Y dimensions for the slide thumbnail
- Create the slide thumbnail and save that on the disk in JPG format
The above steps guide writing Python code to convert PowerPoint slide to image in JPG, where the process is commenced by loading the source presentation from the disk and accessing the desired slide for rendering. In subsequent steps, the customized image dimensions are set to render the slide thumbnail using the get_thumbnail() method and save the image on the disk.
Code to Generate image from PowerPoint Slide in Python
For developing a presentation image creator Python based application code is demonstrated here. The API offers the provision to render the slide thumbnail in TIFF, PNG, BMP or other image formats as well. The image customization can also be performed by using settings like tiff_options, default_regular_font, notes_comments_layouting, size and Image scaling options using different overloads of the get_thumbnail() method.
In this example, we explored how to convert PowerPoint to JPG in Python using a simple API interface. If you want to learn about converting presentation to PDF using python, refer to the article on how to convert Presentation to PDF using Python.