4

请输入图片描述
这是一个开源的网站截屏工具,可分别设置截屏的分辨率,项目放在 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


JeOam
8.7k 声望167 粉丝

热爱互联网