# 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/cs/python-net/merge/html-to-image/
Updated: 2023-04-07



## Sloučit HTML do obrázku pomocí Aspose.Slides

[**Aspose.Slides for Python via .NET**](https://products.aspose.com/slides/cs/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/cs/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

Nainstalujte **Aspose.Slides pro Python přes .NET**. Viz [**Instalace**](https://docs.aspose.com/slides/python-net/installation/).

Přidejte knihovnu jako referenci do svého projektu.

Vytvořte instanci třídy Presentation.

Načtěte dokumenty HTML, které chcete sloučit.

Uložte výsledný obrázek.

## Sloučit další soubory
