Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active November 24, 2024 14:32
Show Gist options
  • Save aspose-com-kb/1554b9d0a528135600b7424b14886987 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/1554b9d0a528135600b7424b14886987 to your computer and use it in GitHub Desktop.
Convert HTML to GIF in Python. For further details:https://kb.aspose.com/html/python/convert-html-to-gif-in-python/
import aspose.html
import os
from aspose.html import *
from aspose.html.converters import *
from aspose.html.saving import *
from aspose.html.drawing import *
from aspose.html.rendering.image import *
path = "C:/"
document_path = os.path.join(path, "input.html")
save_path = os.path.join(path, "html-to-gif.gif")
# Initialize HTML document
document = HTMLDocument(document_path)
# Initialize ImageSaveOptions
options = ImageSaveOptions(ImageFormat.GIF)
# Convert HTML to GIF
Converter.convert_html(document, options, save_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment