Created
May 7, 2015 11:49
-
-
Save skateman/8c33b186d01c3e1001fd to your computer and use it in GitHub Desktop.
PhantomJS Screen Capture
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
/* | |
* Usage: phantomjs capture.js [width] [height] [url] [output] | |
*/ | |
var system = require('system'); | |
var args = system.args; | |
if (args.length === 5) { | |
var width = args[1]; | |
var height = args[2]; | |
var url = args[3]; | |
var output = args[4]; | |
var page = require('webpage').create(); | |
page.viewportSize = { width: width, height: height }; | |
page.open(url, function() { | |
page.render(output); | |
phantom.exit(); | |
}); | |
} else { | |
console.log("Invalid argument!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment