-
-
Save FWeinb/684872b0957e9ecabfc84491ccc62a59 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
'use strict'; | |
var fs = require('fs'); | |
var Promise = require('bluebird'); | |
var screenshot = require('electron-screenshot-service'); | |
// Create 4 electron sub-processes | |
screenshot.scale(4); | |
Promise.all(['http://codepen.io/pens/2', 'http://codepen.io/pens/4', 'http://codepen.io/pens/3'].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); | |
}); | |
// 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