Last active
July 13, 2016 20:46
-
-
Save peerbolte/ac3ba92e11fe4d7321ab517fe1a53d6a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var fs = require('fs'); | |
var Promise = require('bluebird'); | |
var screenshot = require('electron-screenshot-service'); | |
// Create 4 electron sub-processes | |
screenshot.scale(5); | |
Promise.all(['http://codepen.io/anon/pen/OXOYpO', 'http://codepen.io/anon/pen/mEqYBr', 'http://codepen.io/anon/pen/NAwVaB'].map(function (url) { | |
console.log('Screenshot, ', url); | |
return screenshot({ | |
url: url, | |
width: 1024, | |
height: 768, | |
// hide scrollbars | |
transparent: true, | |
page: true, | |
css: 'body{ background:transparent !important;}\n::-webkit-scrollbar{opacity:0 !important;display: none !important;}' | |
}); | |
})) | |
.then(function (arr) { | |
arr.forEach(function (img, i) { | |
fs.writeFileSync('./out' + i + '.png', img.data); | |
}); | |
//console.log('done'); | |
// The process will not be terminated when | |
// close() is not called | |
//screenshot.close(); | |
}) | |
.catch(function (err) { | |
console.log(err); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment