# Convert PowerPoint Slides to PNG in JavaScript

> Convert PowerPoint presentations to high-quality PNG images in JavaScript quickly with Aspose.Slides for Node.js, ensuring precise, automated results.

Source: https://docs.aspose.com/slides/nodejs-java/convert-powerpoint-to-png/
Updated: 2026-08-05


## **Overview**

This article explains how to convert PowerPoint presentations to PNG images using Aspose.Slides. It shows how to load presentation files in formats such as PPT, PPTX, and ODP, render slides as images, and save the results in PNG format.

The article also demonstrates how to customize the generated PNG images by setting scale values or specifying the desired width and height.

## **Convert PowerPoint to PNG**

Go through these steps:

1. Instantiate the [Presentation](https://reference.aspose.com/slides/nodejs-java/aspose.slides/Presentation) class.
2. Get the slide object from the collection returned by the [Presentation.getSlides()](https://reference.aspose.com/slides/nodejs-java/aspose.slides/Presentation#getSlides--) method under the [Slide](https://reference.aspose.com/slides/nodejs-java/aspose.slides/Slide) class.
3. Use a [Slide.getImage()](https://reference.aspose.com/slides/nodejs-java/aspose.slides/Slide) method to get the thumbnail for each slide.
4. Use the  [**IImage.save(String formatName, int imageFormat)**](https://reference.aspose.com/slides/nodejs-java/aspose.slides/iimage/#save) method to save the slide thumbnail to the PNG format.

This JavaScript code shows you how to convert a PowerPoint presentation to PNG:

```javascript
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");

var pres = new aspose.slides.Presentation("pres.pptx");
try {
    for (var index = 0; index < pres.getSlides().size(); index++) {
        var slide = pres.getSlides().get_Item(index);
        var slideImage = slide.getImage();
        try {
            slideImage.save(("image_java_" + index) + ".png", aspose.slides.ImageFormat.Png);
        } finally {
            if (slideImage != null) {
                slideImage.dispose();
            }
        }
    }
} finally {
    if (pres != null) {
        pres.dispose();
    }
}
```

## **Convert PowerPoint to PNG With Custom Dimensions**

If you want to obtain PNG files around a certain scale, you can set the values for `scaleX` and `scaleY`, which are the horizontal and vertical scale factors applied to the slide size. 

This code in JavaScript demonstrates the described operation:

```javascript
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");

var pres = new aspose.slides.Presentation("pres.pptx");
try {
    var scaleX = 2.0;
    var scaleY = 2.0;
    for (var index = 0; index < pres.getSlides().size(); index++) {
        var slide = pres.getSlides().get_Item(index);
        var slideImage = slide.getImage(scaleX, scaleY);
        try {
            slideImage.save(("image_java_" + index) + ".png", aspose.slides.ImageFormat.Png);
        } finally {
            if (slideImage != null) {
                slideImage.dispose();
            }
        }
    }
} finally {
    if (pres != null) {
        pres.dispose();
    }
}
```

## **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: 

```javascript
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");
const java = require("java");

var pres = new aspose.slides.Presentation("pres.pptx");
try {
    var size = java.newInstanceSync("java.awt.Dimension", 960, 720);
    for (var index = 0; index < pres.getSlides().size(); index++) {
        var slide = pres.getSlides().get_Item(index);
        var slideImage = slide.getImage(size);
        try {
            slideImage.save(("image_java_" + index) + ".png", aspose.slides.ImageFormat.Png);
        } finally {
            if (slideImage != null) {
                slideImage.dispose();
            }
        }
    }
} finally {
    if (pres != null) {
        pres.dispose();
    }
}
```

## **FAQ**

### How can I export only a specific shape (e.g., chart or picture) rather than the whole slide?

Aspose.Slides supports [generating thumbnails for individual shapes](/slides/nodejs-java/create-shape-thumbnails/); you can render a shape to a PNG image.

### Is parallel conversion supported on a server?

Yes, but [don’t share](/slides/nodejs-java/multithreading/) a single presentation instance across threads. Use a separate instance per thread or process.

### What are the trial-version limitations when exporting to PNG?

The evaluation mode adds a watermark to output images and enforces [other restrictions](/slides/nodejs-java/licensing/) until a license is applied.



## Related articles

- [Convert PPT and PPTX to JPG in JavaScript](https://docs.aspose.com/slides/nodejs-java/convert-powerpoint-to-jpg/)