vgalin / html2image

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
MIT License
344 stars 44 forks source link

html2image is not working with google-chrome-stable v111 and default flags. #102

Closed jackward-countdown closed 1 year ago

jackward-countdown commented 1 year ago

Currently when no flags are supplied, the flag default-background-color is provided a default of 0. Google Chrome v111 does not accept 0 as a valid default-background-color, it must be supplied in hex rbg/rbga.

[0310/125019.553988:ERROR:headless_command_handler.cc(174)] Expected a hex RGB or RGBA value for --default-background-color=0

This means no screenshot or output file will be produced, however html2image still returns the output path (where there is no file).

Default for default-background-color needs to be updated for be one of those valid formats for chrome v111+

Rolln-dev commented 1 year ago

Can confirm this is an issue. Could not figure out why the images were not being created with no errors.

Setting flag --default-background-color=00000000 corrected the issue as stated by @jackward-countdown

There may also be an issue with sizing as well, specifically the height.

LukeSchmitt96 commented 1 year ago

There may also be an issue with sizing as well, specifically the height.

Chromium bug report 1423030 states that the window-size argument used by this package is broken in versions >=111.

vgalin commented 1 year ago

The default value for the default-background-color flag has been changed in the latest release of the package (python -m pip install --upgrade html2image). See #103 for issues related to screenshots' size being messed up with chromium version >= 111.