Program that convert html to image

html-rendering, linux

Solution

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)

Problem

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?

Original source