Last active
August 29, 2015 14:04
-
-
Save kaizhu256/6637fa028d526b2c236d to your computer and use it in GitHub Desktop.
screen capture using phantomjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
phantomjs-capture.js from https://gist.github.com/kaizhu256/6637fa028d526b2c236d | |
usage example: | |
$ phantomjs phantomjs-capture https://www.google.com gooogle.png 5000 | |
*/ | |
/*jslint browser: true, indent:2, node: true, nomen: true*/ | |
/*global phantom*/ | |
(function submoduleCapturePhantomjs() { | |
/* | |
this phantomjs submodule captures a webpage | |
*/ | |
'use strict'; | |
var local; | |
local = { | |
_name: 'utility2.submoduleCapturePhantomjs', | |
_init: function () { | |
var args, page; | |
args = require('system').args; | |
page = require('webpage').create(); | |
page.viewportSize = { height: 768, width: 1024 }; | |
page.open(args[1], function (status) { | |
console.log('phantomjs - open ' + status + ' ' + args[1]); | |
setTimeout(function () { | |
console.log('phantomjs - rendering ' + args[1] + ' to ' + args[2] + ' ...'); | |
page.render(args[2]); | |
phantom.exit(); | |
}, args[3]); | |
}); | |
} | |
}; | |
local._init(); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment