这是一个开源的网站截屏东西,可离别设置截屏的分辨率,项目放在 GitHub 上:https://github.com/sindresorhus/pageres
一分钟摆布便可认为十个差别的网站截屏 100 张图了。
命令行运用
装置:
$ npm install --global pageres
用于发生截屏的 PhantomJS 会被自动装置;但在某种罕见的情况下,装置也许会失利,然后获得一个毛病: Error: spawn EACCES
。如果有这个毛病,手动下载 PhantomJS,然后重新装置它
用法:
$ 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.
可用于编程的 API
装置:
$ npm install --save pageres
例子:
var pageres = require('pageres');
pageres(['todomvc.com'], ['1366x768', '1600x900'], function () {
console.log('done');
});
编译:Segmentfault