Take screenshots using electron
MIT License
Take screenshots using electron
npm install electron-screenshot-service
var fs = require('fs');
var screenshot = require('electron-screenshot-service');
screenshot({
url : 'http://google.de',
width : 1024,
height : 768
})
.then(function(img){
fs.writeFile('./out.png', img.data, function(err){
screenshot.close();
});
});
Will return a Promise containing an object like:
{
data: <Buffer >
size: {
width: X
height: N
}
}
In addition to all options that can be passed to the BrowserWindow you can pass:
Type: number
(milliseconds)
Default: 0
Delay capturing the screenshot.
Useful when the site does things after loading that you want to capture.
Type: number
Default: 0
Specify the with of the browser window
Type: number
Default: 0
Specify the height of the browser window
Type: Object
Default: undefined
An crop object may look like this:
{
x : 10,
y : 10,
width : 100,
height : 100
}
Type: String
Default: undefined
This css will be injected into the page before the screenshot is taken.
Type: String
Default: undefined
It must contain a function definition that takes on parameter e.g.
js: 'function(takeScreenshot){ /*Do some stuff*/ takeScreenshot();}'
or
js: 'takeScreenshot => { /*Do some stuff*/ takeScreenshot();}'
Type: Boolean
Default: false
This will enable transparency. Keep in mind that most site do set a background color on the html/body tag.
You can overwrite this by using the css
option using something like html,body{ background-color: transparent !important;}
.
Type: Boolean
Default: false
This will try to capture the whole page. width
and height
are considered the minimum size.
Will close the screenshot service. Needed to let the node process exit
Scale the number of electron processes to scale
processes. This will round-robin the screenshot
jobs across scale
instances.
4.0.3
[email protected]
4.0.2
[email protected]
4.0.1
[email protected]
4.0.0
[email protected]
3.3.1
[email protected]
3.3.0
[email protected]
3.2.3
3.2.2
[email protected]
3.2.1
3.2.0
[email protected]
options.js
3.1.3
[email protected]
browserCount
correct. (Thanks to jerbob92)3.1.2
[email protected]
3.1.1
^6.0.0
3.1.0
[email protected]
cross-spawn
insated of cross-spawn-async
3.0.0
[email protected]
[email protected]
2.3.1
[email protected]
2.3.0
[email protected]
2.2.1
count
not being updated when an electron process dies (Thanks to asafyish)[email protected]
2.2.1
2.2.0
[email protected]
.[email protected]
2.1.0
[email protected]
.[email protected]
fixing #112.0.0
[email protected]
.screenshot.scale
API1.7.0
[email protected]
.1.6.0
[email protected]
.1.5.3
[email protected]
.1.5.3
1.5.2
[email protected]
.1.5.1
[email protected]
.1.5.0
[email protected]
.1.4.1
[email protected]
.1.4.0
[email protected]
.1.3.1
[email protected]
.[email protected]
.1.3.0
[email protected]
.1.2.2
[email protected]
.1.2.1
[email protected]
.1.2.0
[email protected]
.1.1.4
[email protected]
.1.1.3
[email protected]
.1.1.1
electron
from closing when last window was closed1.1.0
[email protected]
.electron-downloader
.transparent
support.1.0.2
[email protected]
1.0.1
1.0.0
[email protected]
electron-screenshot-service
0.5.0
[email protected]
data
and size
.0.4.5
0.4.4
.0.22.7
axon
for ipc.0.4.3
0.4.1
socket.io-client
0.4.0
0.20.6
.jquery
because of a "bug" in atom-shell
(See [#254](See https://github.com/atom/atom-shell/issues/254))0.3.2
window.requestAnimationFrame
to be sure that at least one paint has happend.0.3.1
0.3.0
css
option to inject custom css0.2.0
0.20.5
close()
method0.1.3
0.19.5
0.1.2
0.15.8
0.1.1
0.15.4
0.1.0