Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load images using Html2Image - Suddenly stopped working #171

Open
niket07 opened this issue Nov 27, 2024 · 1 comment
Open

Unable to load images using Html2Image - Suddenly stopped working #171

niket07 opened this issue Nov 27, 2024 · 1 comment

Comments

@niket07
Copy link

niket07 commented Nov 27, 2024

Hi!

First of all - Thanks for this amazing package!

I have the following python code:

from html2image import Html2Image
def htmlToImage(str):
x=str.split('&')
hti = Html2Image(custom_flags=['--virtual-time-budget=70000', '--hide-scrollbars'])
hti.output_path = x[0]
css = ""
hti.screenshot(html_file=x[1],css_str=css,save_as=x[2],size=(int(x[3]),int(x[4])))

The package is unable to load images inside the HTML. The images render with their 'alt text'. Example:

Screenshot 2024-11-27 215848

I'm not sure why this might be happening?

I know there might be a very simple solution to this, but I have spent way too many hours resolving this! Any help here would be highly appreciated.

@vgalin
Copy link
Owner

vgalin commented Nov 29, 2024

Hi, could you take a look at my comment here and tell me if that helps? Basically, using absolute paths for the images should do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants