Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save raval08255/f2e8093afa1a8c5e019c3b030c3ef81d to your computer and use it in GitHub Desktop.
Save raval08255/f2e8093afa1a8c5e019c3b030c3ef81d 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