Convert PowerPoint to PNG
About PowerPoint to PNG Conversion
The PNG (Portable Network Graphics) format is not as popular as JPEG (Joint Photographic Experts Group), but it still very popular.
Use case: When you have a complex image and size is not an issue, PNG is a better image format than JPEG.
Tip
You may want to check out Aspose free PowerPoint to PNG Converters: PPTX to PNG and PPT to PNG. They are a live implementation of the process described on this page.Convert PowerPoint to PNG
Go through these steps:
- Instantiate the Presentation class.
- Get the slide object from the Presentation.Slides collection under the ISlide interface.
- Use a ISlideGetThumbnail method to get the thumbnail for each slide.
- Use the IPresentation.SaveMethod(String, SaveFormat, ISaveOptions method to save the slide thumbnail to the PNG format.
This Python code shows you how to convert a PowerPoint presentation to PNG:
import aspose.slides as slides
import aspose.pydrawing as drawing
pres = slides.Presentation("pres.pptx")
for index in range(pres.slides.length):
slide = pres.slides[index]
slide.get_thumbnail().save("slide_{i}.png".format(i = index), drawing.imaging.ImageFormat.png)
Convert PowerPoint to PNG With Custom Dimensions
If you want to obtain PNG files around a certain scale, you can set the values for desiredX
and desiredY
, which determine the dimensions of the resulting thumbnail.
This code in Python demonstrates the described operation:
import aspose.slides as slides
import aspose.pydrawing as drawing
pres = slides.Presentation("pres.pptx")
scaleX = 2
scaleY = 2
for index in range(pres.slides.length):
slide = pres.slides[index]
slide.get_thumbnail(scaleX, scaleY).save("slide_{index}.png".format(index=index), drawing.imaging.ImageFormat.png)
Convert PowerPoint to PNG With Custom Size
If you want to obtain PNG files around a certain size, you can pass your preferred width
and height
arguments for ImageSize
.
This code shows you how to convert a PowerPoint to PNG while specifying the size for the images:
import aspose.slides as slides
import aspose.pydrawing as drawing
pres = slides.Presentation(path + "pres.pptx")
size = drawing.Size(960, 720)
for index in range(pres.slides.length):
slide = pres.slides[index]
slide.get_thumbnail(size).save("slide_{index}.png".format(index=index), drawing.imaging.ImageFormat.png)