Convert PNG to PPTX in Python

Powerful cross-platform Python API for converting PNG to PPTX using Python code

Convert PNG to PPTX using Aspose.Slides

Aspose.Slides for Python via .NET is a powerful Python library used to create, convert, and manipulate PowerPoint presentations, PDFs, HTML docs, and other files. When you convert PNG to PPTX, you are essentially creating a PowerPoint presentation that contains slides based on PNG images.

Convert PNG to PPTX in Python

Using Aspose.Slides for Python via .NET , you can convert PNG image to PowerPoint presentation with just a few lines of code:

Python code for converting PNG to PPTX

import aspose.slides as slides

with slides.Presentation() as pres:
    slide = pres.slides[0]
    with open("img.png", "rb") as in_file:
        image = pres.images.add_image(in_file)
        slide.shapes.add_picture_frame(slides.ShapeType.RECTANGLE, 10, 10, 100, 100, image)
    
    pres.save("pres_with_image.pptx", slides.export.SaveFormat.PPTX)

How to convert PNG to PPTX in Python

  1. Install Aspose.Slides for Python via .NET. See Installation .

  2. Add the library as a reference in your project.

  3. Create an instance of the Presentation class.

  4. Load the PNG image you want to convert to PPTX.

  5. Save the resulting file as a PPTX presentation.

Other Supported PowerPoint Conversions

You can also convert files in other formats to PowerPoint