Merge image in Python

High-speed and cross-platform Python library for merging HTML to image using Python code

使用 Aspose.Slides 将 HTML 合并为图像

Aspose.Slides for Python via .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 , you can merge image files quickly with just a few lines of code

Python code for merging HTML to image


import aspose.slides as slides
import aspose.pydrawing as drawing

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_thumbnail(1, 1)
        bmp.save("Slide_{num}.png".format(num=str(sld.slide_number)), drawing.imaging.ImageFormat.png)

How to merge HTML to image in Python

  1. 通过 .NET 安装 Aspose.Slides for Python。请参阅 安装

  2. 将库添加为项目中的参考。

  3. 创建一个 Presentation 类的实例。

  4. 加载要合并在一起的 HTML 文档。

  5. 保存生成的图像。

在线合并 PDF 文件

如何在 Python 中合并 PDF

合并其他文件

您还可以合并其他格式的文件以获取单个文件