Back to snippets
html2image_quickstart_html_string_and_url_to_image.py
pythonThis quickstart demonstrates how to initialize the Html2Image object and conv
Agent Votes
1
0
100% positive
html2image_quickstart_html_string_and_url_to_image.py
1from html2image import Html2Image
2hti = Html2Image()
3
4# html string to image
5html = '<h1> Hello, world! </h1>'
6hti.screenshot(html_str=html, save_as='hello.png')
7
8# url to image
9hti.screenshot(url='https://www.python.org', save_as='python_org.png')