'Program that convert html to image

Is there a ready-to-use program, that I can run from my web application, to convert an HTML file to an image? Preferably using Webkit, or another mature browser engine?

I tried wkhtmltoimage, but it doesn't render backgrounds correctly (while wkhtmltopd works fine). Is there one that works?



Solution 1:[1]

Method A

Using phantomjs

$ phantom rasterize.js http://www.google.com google.png

Download and unzip the binary archive. rasterize.js is in the example directory.

Method B

Using chrome (Tested on MacOSX, should work on other platforms)

$ alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
$ chrome --headless --disable-gpu --screenshot=google.png http://www.google.com

Method C

Using webkit2png (macOS only)

Solution 2:[2]

simply use firefox

firefox --headless --screenshot google.com

or visit here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Kasra