Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active November 17, 2022 11:13
Show Gist options
  • Save aspose-com-gists/1e1f217acbf403c0161746ff3e4f07d9 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/1e1f217acbf403c0161746ff3e4f07d9 to your computer and use it in GitHub Desktop.
Convert PowerPoint PPT or PPTX to PNG in Python
import aspose.slides as slides
import aspose.pydrawing as drawing
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Loop through slides
for index in range(pres.slides.length):
# Get reference of slide
slide = pres.slides[index]
# Define scaling
scaleX = 2
scaleY = 2
# Save as PNG
slide.get_thumbnail(scaleX, scaleY).save("slide_{i}.png".format(i = index), drawing.imaging.ImageFormat.png)
import aspose.slides as slides
import aspose.pydrawing as drawing
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Loop through slides
for index in range(pres.slides.length):
# Get reference of slide
slide = pres.slides[index]
# Define custom size
size = drawing.Size(960, 720)
# Save as PNG
slide.get_thumbnail(size).save("slide_{i}.png".format(i = index), drawing.imaging.ImageFormat.png)
import aspose.slides as slides
import aspose.pydrawing as drawing
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Loop through slides
for index in range(pres.slides.length):
# Get reference of slide
slide = pres.slides[index]
# Save as PNG
slide.get_thumbnail().save("slide_{i}.png".format(i = index), drawing.imaging.ImageFormat.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment