-
Notifications
You must be signed in to change notification settings - Fork 73
/
snap.js
33 lines (30 loc) · 631 Bytes
/
snap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
requires: phantomjs, async
usage: phantomjs snap.js
*/
var args = require('system').args;
var site = args[1];
var name = args[2];
var timeout = args[3] || 0;
var sizes = [1000, 800];
var page = require('webpage').create();
page.viewportSize = {
width: sizes[0],
height: sizes[1]
};
page.clipRect = {
top: 0,
left: 0,
width: sizes[0],
height: sizes[1]
};
page.zoomFactor = 0.9;
page.open(site, function (status) {
setTimeout(function(){
var filename = name + '.png';
page.render('./screenshots/' + filename);
page.close();
console.log('done!');
phantom.exit();
}, timeout);
});