# Convert PPTM to PNG in PHP

> Convert PPTM slides to PNG images in PHP with Aspose.Slides. Use the sample code to render each slide in a macro-enabled PowerPoint presentation as a separate PNG file.

Source: https://products.aspose.com/slides/php-java/conversion/pptm-to-png/
Updated: 2026-08-11



## Convert PPTM to PNG in PHP

Convert PPTM slides to PNG programmatically with [*Aspose.Slides for PHP via Java*](/slides/php-java/). Load a macro-enabled PowerPoint presentation and render every slide as an individual PNG image with a few lines of PHP code.

Aspose.Slides renders a slide through its `getImage` method and saves the result through the image object's `save` method. You can also try the PPTM-to-PNG conversion in your [browser](https://products.aspose.app/slides/conversion) before integrating it into your application.

You can install the library from [Composer](https://packagist.org/packages/aspose/slides) using the following command:

### Console/Terminal

```console
composer require aspose/slides
```

## How to Convert PPTM to PNG in PHP

These are the steps to convert a PPTM file to PNG using PHP.

Load the PPTM file into a `Presentation` instance.

Access each slide through a variable and call its `getImage` method.

Save each rendered slide to the generated file path with `ImageFormat::Png`.

## System Requirements

Before running the PHP conversion sample, make sure that you have the following prerequisites.

1. Install PHP 7 or later, add the PHP directory to the system `PATH`, and set `allow_url_include` to `On` in `php.ini`.
1. Install JRE 8 and set the `JAVA_HOME` environment variable to the installed JRE directory.
1. Install Apache Tomcat 8.0 as described in the [installation guide](https://docs.aspose.com/slides/php-java/installation/).

### This sample code shows PPTM-to-PNG conversion in PHP

```php
$presentation = new Presentation("input.pptm");
try {
    $slideCount = java_values($presentation->getSlides()->size());

    for ($slideIndex = 0; $slideIndex < $slideCount; $slideIndex++) {
        $slide = $presentation->getSlides()->get_Item($slideIndex);
        $slideImage = $slide->getImage(2.0, 2.0);

        try {
            $filePath = "slide_" . ($slideIndex + 1) . ".png";
            $slideImage->save($filePath, ImageFormat::Png);
        } finally {
            $slideImage->dispose();
        }
    }
} finally {
    $presentation->dispose();
}
```

## Save PPTM as PNG in PHP

Use the free app to see a demonstration of the PPTM-to-PNG conversion process.

## Other Supported Conversions

- [PPTM TO BMP](/slides/php-java/conversion/pptm-to-bmp/) — Bitmap Image
- [PPTM TO FODP](/slides/php-java/conversion/pptm-to-fodp/) — OpenDocument Flat XML Presentation
- [PPTM TO GIF](/slides/php-java/conversion/pptm-to-gif/) — Graphics Interchange Format
- [PPTM TO HTML](/slides/php-java/conversion/pptm-to-html/) — Hypertext Markup Language
- [PPTM TO JPG](/slides/php-java/conversion/pptm-to-jpg/) — JPEG Image
- [PPTM TO ODP](/slides/php-java/conversion/pptm-to-odp/) — OpenDocument Presentation Format
- [PPTM TO OTP](/slides/php-java/conversion/pptm-to-otp/) — OpenDocument Presentation Template
- [PPTM TO PDF](/slides/php-java/conversion/pptm-to-pdf/) — Portable Document Format
- [PPTM TO POT](/slides/php-java/conversion/pptm-to-pot/) — PowerPoint 97-2003 Template
- [PPTM TO POTM](/slides/php-java/conversion/pptm-to-potm/) — Macro-Enabled PowerPoint Template
- [PPTM TO POTX](/slides/php-java/conversion/pptm-to-potx/) — Open XML PowerPoint Template
- [PPTM TO PPS](/slides/php-java/conversion/pptm-to-pps/) — PowerPoint 97-2003 Slide Show
- [PPTM TO PPSM](/slides/php-java/conversion/pptm-to-ppsm/) — Macro-Enabled PowerPoint Slide Show
- [PPTM TO PPSX](/slides/php-java/conversion/pptm-to-ppsx/) — Open XML PowerPoint Slide Show
- [PPTM TO PPT](/slides/php-java/conversion/pptm-to-ppt/) — PowerPoint 97-2003 Presentation
- [PPTM TO PPTX](/slides/php-java/conversion/pptm-to-pptx/) — Open XML PowerPoint Presentation
- [PPTM TO SVG](/slides/php-java/conversion/pptm-to-svg/) — Scalable Vector Graphics
- [PPTM TO SWF](/slides/php-java/conversion/pptm-to-swf/) — Small Web Format
- [PPTM TO TIFF](/slides/php-java/conversion/pptm-to-tiff/) — Tagged Image File Format
- [PPTM TO XPS](/slides/php-java/conversion/pptm-to-xps/) — XML Paper Specification
