When you want to take screenshots with PhantomJS, you probably need to wait before your page is completely loaded. I mean all resources are loaded and scripts executed.
Use the following code to delay your screenshot :
var page = new WebPage();
page.open('http://stackoverflow.com/', function (status) {
just_wait();
});
function just_wait() {
setTimeout(function() {
page.render('screenshot.png');
phantom.exit();
}, 2000);
}
Here we wait 2000ms before saving the screenshot. Adjust it to fit your needs.
Edit 2016-08-31
Since phantomjs 1.2, you can use the callback onLoadFinished() which is much better than a simple guess on the rendering time…
var page = new WebPage();
page.open('http://charles.lescampeurs.org/');
page.onLoadFinished = function(status) {
page.render('screenshot.png');
phantom.exit();
};