Open LukasReindlGit opened 1 year ago
I had the same issue. Not sure what version of Chrome is causing this but Adi's solution for another issue also ended up fixing this issue for me. (Windows)
Fix:
I've managed to bypass this on Windows by installing an older portable version of Chrome v109 - googlechromeportable64_109.0.5414.120_online.paf
(https://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/) and using in my program. I installed in the same folder.
hti=Html2Image(browser_executable='GoogleChromePortable64/App/Chrome-bin/chrome.exe') hti.size=(2046,2046) ... hti.screenshot(......)
Tested on latest html2image (2.0.3)
For now, you can use the --default-background-color
flag to force transparent background color, like so:
hti = Html2Image(custom_flags=['--no-sandbox', '--default-background-color=00000000'])
Would be nice to be able to pass those custom flags when using the CLI too. Right now, there doesn't seem to be a way to do so?
When I ran this code I was used to get a transparent image with only the red text. Now the background is white. Is it a known issue based on some chrome version? Since I am running my code in a docker container, I am quite flexible.