The web2image
will take a screenshot of a given web page.
Web to image
built on 2017-07-23
Tool to take screenshot from a web page
Usage:
web2image OPTIONS... URL IMAGE-FILE
Options:
-h, --help display help information
-d, --headless use chrome-headless docker as client instead of chrome
-c, --css *the CSS selector for the region to take the screenshot of
-s, --sleep[=3s] time to sleep before waiting for above CSS (default: 3 seconds)
-w, --wait-for the CSS selector to wait for before taking the screenshot
-v, --verbose verbose mode (multiple -v options increase the verbosity.)
The following examples assumes that you've setup chrome-headless already. Else, take a look at Chrome DevTools Protocol on how to start a local chrome with the remote-debugging-port opening at 9222
.
web2image -d -c '#main-wrapper' 'http://www.cmore.se/film/3643033-deadpool' example-deadpool.png
and the result is:
web2image -d -s '5s' -c 'div > section.market-indexes-component > div.market-indexes-container' http://www.morningstar.com/ example-US-market-indexes.png
and the result is:
The latest binary executables are available under
https://bintray.com/suntong/bin/web2image#files/web2image
as the result of the Continuous-Integration process.
I.e., they are built right from the source code during every git commit automatically by travis-ci.
Pick & choose the binary executable that suits your OS and its architecture. E.g., for Linux, it would most probably be the -linux-amd64
file. If your OS and its architecture is not available in the download list, please let me know and I'll add it.
To install the source code instead:
go get github.com/suntong/web2image
All patches welcome.