# Convert PDF to Image in Python

> Convert PDF pages to images in Python. Use the Aspose.Slides Python API to import a PDF and render each page as a PNG image.

Source: https://products.aspose.com/slides/python-net/conversion/pdf-to-image/
Updated: 2026-07-23



## Convert PDF to Image in Python

[*Aspose.Slides for Python via .NET*](/slides/python-net/) lets you convert PDF pages to raster images programmatically. The API provides `SlideCollection.add_from_pdf` for importing PDF content and `Slide.get_image` for rendering each imported page.

The example below saves each PDF page as a separate PNG image. You can select another supported raster format by changing the output extension and the `ImageFormat` value.

## Convert PDF to Image using Python

Create a `Presentation`, remove its default blank slide, import the PDF pages, and render each imported `Slide` as an image.

### Python code for converting PDF into Image

```python
with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)
    presentation.slides.add_from_pdf("document.pdf")

    for slide in presentation.slides:
        file_path = f"document_page_{slide.slide_number}.png"
        with slide.get_image() as slide_image:
            slide_image.save(file_path, slides.ImageFormat.PNG)
```

## How to Convert PDF to Images Using the Aspose.Slides Python API

These are the steps to convert PDF pages to images in Python.

Install [*Aspose.Slides for Python via .NET*](/slides/python-net/).

Create a `Presentation` and remove its default blank slide.

Import the source PDF by using `SlideCollection.add_from_pdf`.

Render each imported `Slide` with `Slide.get_image` and save it by using `IImage.save`.

## Convert PDF to Other Supported Formats

- [PDF TO HTML](/slides/python-net/conversion/pdf-to-html/)
- [PDF TO JPG](/slides/python-net/conversion/pdf-to-jpg/)
- [PDF TO PNG](/slides/python-net/conversion/pdf-to-png/)
- [PDF TO TIFF](/slides/python-net/conversion/pdf-to-tiff/)
- [PDF TO XML](/slides/python-net/conversion/pdf-to-xml/)
- [PDF TO SVG](/slides/python-net/conversion/pdf-to-svg/)
- [PDF TO PPTX](/slides/python-net/conversion/pdf-to-pptx/)
- [PDF TO PPT](/slides/python-net/conversion/pdf-to-ppt/)
