Last active
December 15, 2015 15:59
-
-
Save b-oern/5285469 to your computer and use it in GitHub Desktop.
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 screenshot.js http://google.de /pi/a.png | |
*/ | |
var page = require('webpage').create(), | |
system = require('system'); | |
page.viewportSize = { width: 1280, height: 800 }; | |
if (system.args.length === 1) { | |
console.log('Usage: screenshot.js <some URL> <Image>'); | |
phantom.exit(); | |
} | |
var address = system.args[1]; | |
var image = system.args[2]; | |
page.open(address, function (status) { | |
if (status !== 'success') { | |
console.log('FAIL to load the address'); | |
} else { | |
page.render(image); | |
} | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment