# Convert Presentation Slides to Images in PHP

> Convert slides from PPT, PPTX and ODP to images using Aspose.Slides for PHP via Java — fast, high-quality rendering with clear code examples.

Source: https://docs.aspose.com/slides/php-java/convert-slide/
Updated: 2026-08-03


## **Introduction**

Aspose.Slides for PHP via Java enables you to easily convert PowerPoint and OpenDocument presentation slides into various image formats, including BMP, PNG, JPG (JPEG), GIF, and others.

To convert a slide into an image, follow these steps:

1. Define the desired conversion settings and select the slides you want to export by using:
    - The [TiffOptions](https://reference.aspose.com/slides/php-java/aspose.slides/tiffoptions/) class, or
    - The [RenderingOptions](https://reference.aspose.com/slides/php-java/aspose.slides/renderingoptions/) class.
2. Generate the slide image by calling the [getImage](https://reference.aspose.com/slides/php-java/aspose.slides/slide/#getImage) method.

In Aspose.Slides for PHP via Java, an [IImage](https://reference.aspose.com/slides/php-java/aspose.slides/iimage/) is a class that allows you to work with images defined by pixel data. You can use this class to save images in a wide range of formats (BMP, JPG, PNG, etc.).

## **Convert Slides to Bitmaps and Save the Images in PNG**

You can convert a slide to a bitmap object and use it directly in your application. Alternatively, you can convert a slide to a bitmap and then save the image in JPEG or any other preferred format.

This code demonstrates how to convert the first slide of a presentation to a bitmap object and then save the image in PNG format:

```php
$presentation = new Presentation("Presentation.pptx");
try {
    // Convert the first slide in the presentation to a bitmap.
    $image = $presentation->getSlides()->get_Item(0)->getImage();
    try {
        // Save the image in the PNG format.
        $image->save("Slide_0.png", ImageFormat::Png);
    } finally {
        $image->dispose();
    }
} finally {
    $presentation->dispose();
}
```

## **Convert Slides to Images with Custom Sizes**

You may need to get an image of a certain size. Using an overload from the [getImage](https://reference.aspose.com/slides/php-java/aspose.slides/slide/#getImage), you can convert a slide to an image with specific dimensions (width and height). 

This sample code demonstrates how to do this:

```php
$imageSize = new Java("java.awt.Dimension", 1820, 1040);

$presentation = new Presentation("Presentation.pptx");
try {
    // Convert the first slide in the presentation to a bitmap with the specified size.
    $image = $presentation->getSlides()->get_Item(0)->getImage($imageSize);
    try {
        // Save the image in the JPEG format.
        $image->save("Slide_0.jpg", ImageFormat::Jpeg);
    } finally {
        $image->dispose();
    }
} finally {
    $presentation->dispose();
}
```

## **Convert Slides with Notes and Comments to Images**

Some slides may contain notes and comments.

Aspose.Slides provides two classes[TiffOptions](https://reference.aspose.com/slides/php-java/aspose.slides/tiffoptions/) and [RenderingOptions](https://reference.aspose.com/slides/php-java/aspose.slides/renderingoptions/)—that allow you to control the rendering of presentation slides to images. Both classes include the `setSlidesLayoutOptions` method, which enables you to configure the rendering of notes and comments on a slide when converting it to an image.

With the [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/php-java/aspose.slides/notescommentslayoutingoptions/) class, you can specify your preferred position for notes and comments in the resulting image.

This code demonstrates how to convert a slide with notes and comments:

```php
$scaleX = 2;
$scaleY = $scaleX;

$presentation = new Presentation("Presentation_with_notes_and_comments.pptx");
try {
    $notesCommentsOptions = new NotesCommentsLayoutingOptions();
    $notesCommentsOptions->setNotesPosition(NotesPositions::BottomTruncated);         // Set the position of the notes.
    $notesCommentsOptions->setCommentsPosition(CommentsPositions::Right);             // Set the position of the comments.
    $notesCommentsOptions->setCommentsAreaWidth(500);                                 // Set the width of the comments area.
    $notesCommentsOptions->setCommentsAreaColor(java("java.awt.Color")->LIGHT_GRAY);  // Set the color for the comments area.

    // Create the rendering options.
    $options = new RenderingOptions();
    $options->setSlidesLayoutOptions($notesCommentsOptions);

    // Convert the first slide of the presentation to an image.
    $image = $presentation->getSlides()->get_Item(0)->getImage($options, $scaleX, $scaleY);
    try {
        // Save the image in the GIF format.
        $image->save("Image_with_notes_and_comments_0.gif", ImageFormat::Gif);
    } finally {
        $image->dispose();
    }
} finally {
    $presentation->dispose();
}
```

{{% alert title="Note" color="warning" %}} 

In any slide-to-image conversion process, the [setNotesPosition](https://reference.aspose.com/slides/php-java/aspose.slides/notescommentslayoutingoptions/#setNotesPosition) method cannot apply `BottomFull` (to specify the position for notes) because a note's text may be too large, making it unable to fit within the specified image size.

{{% /alert %}} 

## **Convert Slides to Images Using TIFF Options**

The [TiffOptions](https://reference.aspose.com/slides/php-java/aspose.slides/tiffoptions/) class provides greater control over the resulting TIFF image by allowing you to specify parameters such as size, resolution, color palette, and more.

This code demonstrates a conversion process where TIFF options are used to output a black-and-white image with a 300 DPI resolution and a size of 2160 × 2800:

```php
// Load a presentation file.
$presentation = new Presentation("sample.pptx");
try {
    // Get the first slide from the presentation.
    $slide = $presentation->getSlides()->get_Item(0);

    // Configure the settings of the output TIFF image.
    $options = new TiffOptions();
    $options->setImageSize(new Java("java.awt.Dimension", 2160, 2880));  // Set the image size.
    $options->setPixelFormat(ImagePixelFormat::Format1bppIndexed);       // Set the pixel format (black and white).
    $options->setDpiX(300);                                              // Set the horizontal resolution.
    $options->setDpiY(300);                                              // Set the vertical resolution.
    
    // Convert the slide to an image with the specified options.
    $image = $slide->getImage($options);
    try {
        // Save the image in TIFF format.
        $image->save("output.tiff", ImageFormat::Tiff);
    } finally {
        $image->dispose();
    }
} finally {
    $presentation->dispose();
}
```

{{% alert title="Note" color="warning" %}} 

Tiff support is not guaranteed in versions earlier than JDK 9.

{{% /alert %}} 

## **Convert All Slides to Images**

Aspose.Slides allows you to convert all slides in a presentation to images, effectively converting the entire presentation into a series of images.

This sample code demonstrates how to convert all slides in a presentation to images in PHP:

```php
$scaleX = 2;
$scaleY = $scaleX;

$presentation = new Presentation("Presentation.pptx");
try {
    // Render the presentation to images slide by slide.
    for($i = 0; $i < java_values($presentation->getSlides()->size()) ; $i++) {
        // Control hidden slides (do not render hidden slides).
        if (java_values($presentation->getSlides()->get_Item($i)->getHidden())) {
            continue;
        }

        // Convert the slide to an image.
        $image = $presentation->getSlides()->get_Item($i)->getImage($scaleX, $scaleY);
        try {
            // Save the image in the JPEG format.
            $image->save("Slide_" . $i . ".jpg", ImageFormat::Jpeg);
        } finally {
            $image->dispose();
        }
    }
} finally {
    $presentation->dispose();
}
```

## **Color Emoji Rendering**

{{% alert title="Note" color="warning" %}} 
To render color emojis correctly when converting presentation slides to images, the emoji fonts used in the presentation must be installed and available on the system performing the conversion. For example, if the presentation uses **Segoe UI Emoji** and this font is missing, emojis may appear in monochrome in the output images.
{{% /alert %}}

## **FAQ**

**Does Aspose.Slides support rendering slides with animations?**

No, the `getImage` method saves only a static image of the slide, without animations.

**Can hidden slides be exported as images?**

Yes, hidden slides can be processed just like regular ones. Just make sure they are included in the processing loop.

**Can images be saved with shadows and effects?**

Yes, Aspose.Slides supports rendering shadows, transparency, and other graphic effects when saving slides as images.

