這是一個開源的網站截屏工具,可分別設置截屏的分辨率,項目放在 GitHub 上:https://github.com/sindresorhus/pagereshtml
一分鐘左右就能夠爲十個不一樣的網站截屏 100 張圖了。git
安裝:github
$ npm install --global pageres
用於產生截屏的 PhantomJS 會被自動安裝;但在某種罕有的狀況下,安裝或許會失敗,而後獲得一個錯誤: Error: spawn EACCES
。若是有這個錯誤,手動下載 PhantomJS,而後從新安裝它web
用法:npm
$ pageres --help Get screenshots of websites in different resolutions. Specify urls and screen resolutions as arguments. Order doesn't matter. Screenshots are saved in the current directory. Usage pageres <url> <resolution> [<resolution> <url> ...] pageres [<url> <resolution> ...] < <file> cat <file> | pageres [<url> <resolution> ...] Example pageres todomvc.com yeoman.io 1366x768 1600x900 pageres 1366x768 < urls.txt cat screen-resolutions.txt | pageres todomvc.com yeoman.io You can also pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments. If no screen resolutions are specified it will fall back to the ten most popular ones according to w3counter.
安裝:編程
$ npm install --save pageres
例子:segmentfault
var pageres = require('pageres'); pageres(['todomvc.com'], ['1366x768', '1600x900'], function () { console.log('done'); });
編譯:Segmentfaultmvc