Take screenshots with PhantomJS
Usage:
$ phantomjs screenshot.js http://your-url.com/| var system = require('system'), | |
| page = require('webpage').create(), | |
| url = system.args[1], | |
| match = /.+\.\w\w.*/; | |
| page.viewportSize = { width: 1280, height: 1200 }; | |
| if (url.length && match.test(url)) { | |
| page.open(system.args[1], function() { | |
| page.render(Math.random().toString(10).substring(7) + '.png'); | |
| phantom.exit(); | |
| console.log('Saved screenshot for ' + url); | |
| }); | |
| } else { | |
| phantom.exit(); | |
| console.log('Incorrect URL "' + url + '"'); | |
| } |