Develop your own PowerPoint to JPG converter using a Cloud-based API. Save PowerPoint images or complete PowerPoint slides to JPG online

PPT to JPG

PPT to JPG Converter | Save PowerPoint to JPG using Python

This article explains the conversion of PPT to JPG using Python. The reason we are converting PowerPoint presentations to JPG images is that they can easily be viewed on all platforms. No special software is required to view these images. Whereas, in order to view PowerPoint presentations, we need special applications such as MS PowerPoint, OpenOffice Impress, etc. Also, different versions of these applications may disturb the layout of presentation files, so the conversion to JPG images can prevent us from these rendering issues.

Info: You may want to check out Aspose FREE PowerPoint to JPG converter.

PowerPoint to JPG Conversion API

In order to programmatically convert PPT files to JPG format, we are going to use Aspose.Slides Cloud SDK for Python. It is a wrapper around Aspose.Slides Cloud and can be downloaded from PIP and GitHub. Execute the following command on the command line terminal to install the SDK.

pip install asposeslidescloud

The next important step is to obtain your personalized ClientID and ClientSecret details. Therefore, the first step is to create an account by visiting Aspose.Cloud dashboard.

PPT to JPG using Python

In order to perform the conversion, please follow the steps explained below.

  • First, we need to create an object of the Configuration class
  • Secondly, initialize the SlidesApi instance while passing the Configuration object as an input argument
  • Read PPT file local drive into a local object
  • Now in order to perform the conversion, we need to call the save_slide_online(…) method of SlidesApi which takes the input PPT file, index of the slide to be converted, resultant format as JPG, name of resultant file, and JPG dimensions as arguments
PPT to JPG Conversion preview

Image 1:- PPT to JPG conversion preview.

The sample file used in the above example can be downloaded from test-unprotected.pptx.

Convert PPTX to JPG using cURL Command

Aspose.Slides Cloud can also be accessed via cURL commands. So one of the prerequisites is to generate a JWT access token based on your client credentials. Please execute the following command to generate the token.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=88d1cda8-b12c-4a80-b1ad-c85ac483c5c5&client_secret=406b404b2df649611e508bbcfcd2a77f" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once the JWT is generated, please execute the following command to convert PPT to JPG format.

curl -X PUT "https://api.aspose.cloud/v3.0/slides/slides/2/Jpeg?outPath=Converted.jpg&width=800&height=1000" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"document":{test-unprotected.ppt}}

Conclusion

In this article, we have discussed in detail the steps to develop your own PPT to JPG converter using Python SDK. Similarly, we have also explored the details of how we can save PPTX to JPG using the cURL commands. The complete source code of Python SDK is also available for free download over GitHub. You may visit the Programmers Guide to learn more about other exciting features of the API.