# Merge HTML to Image in Python

> Merge HTML to image in Python. Use Python library API to combine HTML to image

Source: https://products.aspose.com/slides/it/python-net/merge/html-to-image/
Updated: 2023-04-07



## Unisci HTML all'immagine usando Aspose.Slides

[**Aspose.Slides for Python via .NET**](https://products.aspose.com/slides/it/python-net/) is a powerful Python library used to merge and manipulate presentations, HTML docs, and other files. When you merge HTML to image, you are effectively combining the contents in HTML documents to obtain a single image.

## Merge HTML to image in Python

Using [**Aspose.Slides for Python via .NET**](https://products.aspose.com/slides/it/python-net/), you can merge image files quickly with just a few lines of code

### Python code for merging HTML to image

```python

import aspose.slides as slides

with open("file1.html", "rt", encoding="utf-8") as stream:
    htmlText1 = stream.read()
with open("file2.html", "rt", encoding="utf-8") as stream:
    htmlText2 = stream.read()

with slides.Presentation() as pres:
    pres.slides.remove_at(0)
    pres.slides.add_from_html(htmlText1)
    pres.slides.add_from_html(htmlText2)

    for sld in pres.slides:
        bmp = sld.get_image(1, 1)
        bmp.save("Slide_{num}.png".format(num=str(sld.slide_number)), slides.ImageFormat.PNG)
```

## How to merge HTML to image in Python

Install **Aspose.Slides for Python via .NET**. See [**Installation**](https://docs.aspose.com/slides/python-net/installation/).

Aggiungi la libreria come riferimento nel tuo progetto.

Crea un'istanza della classe Presentation.

Carica i documenti HTML che vuoi unire insieme.

Salva l'immagine risultante.

## Unisci altri file
