diff --git a/README.md b/README.md index ebe25f3..510b7f9 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,9 @@ containing the image. If no `fn` is provided, a thunk/continuable is returned. +If the page has a transparent background, it will be set to `white` before +capturing. + ## Installation Make sure you have a working installation of diff --git a/example.js b/example.js index 45539cb..d71e62c 100644 --- a/example.js +++ b/example.js @@ -1,7 +1,7 @@ var screenshot = require('./'); var fs = require('fs'); -screenshot('http://google.com/') +screenshot('http://ghub.io/') .width(800) .height(600) .capture(function(err, img) { diff --git a/example.png b/example.png index 9462121..ffd0d7a 100644 Binary files a/example.png and b/example.png differ diff --git a/script/render.js b/script/render.js index cd5ee0f..8b7b549 100644 --- a/script/render.js +++ b/script/render.js @@ -43,6 +43,11 @@ page.onError = noop; page.open(url, function (status) { if (status !== 'success') throw new Error('Unable to load'); window.setTimeout(function () { + page.evaluate(function() { + if (!document.body.style.background) { + document.body.style.backgroundColor = 'white'; + } + }); console.log(page.renderBase64(format)); phantom.exit(); }, timeout);