I am trying to understand the html2image package. But it does not seem to find my locally stored images.
I use the following code:
from html2image import Html2Image
hti = Html2Image()
html_str ="""
<!DOCTYPE html>
<html>
<body>
<img src="example.jpg">
</body>
</html>
"""
css_str = """
body {
margin: 0;
background: black;
}
"""
hti.screenshot(html_str=html_str, css_str=css_str, save_as="test.png")
Here "example.jpg" is an image of a flower saved in the same folder as the python script.
The html_str copied into another file can be displayed by a browser without any problem.
But when running the above python script, I end up with a mostly black image with corrupted file symbol in the upper left corner.
Is there a way to fix this? Or does html2image not support the img tag?