screenshot-desktop
Capture a screenshot of your local machine
- Multi/Cross Platform
- Linux: required ImageMagick
apt-get install imagemagick
- OSX: No dependencies required!
- Windows: No dependencies required!
- Promise based API
- JPG output (by default)
Install
$ npm install --save screenshot-desktop
Usage
const screenshot = require('screenshot-desktop')
screenshot().then((img) => {
}).catch((err) => {
})
const screenshot = require('screenshot-desktop')
screenshot({format: 'png'}).then((img) => {
}).catch((err) => {
})
screenshot.listDisplays().then((displays) => {
screenshot({ screen: displays[displays.length - 1].id })
.then((img) => {
});
})
screenshot.all().then((imgs) => {
})
screenshot({ filename: 'shot.jpg' }).then((imgPath) => {
});
screenshot({ filename: '/Users/brian/Desktop/demo.png' })
screenshot() options
filename
Optional. Absolute or relative path to save output.format
Optional. Valid values png|jpg
.linuxLibrary
Optional. Linux only. Valid values scrot|imagemagick
. Which library to use. Note that scrot does not support format or screen selection.
Licence
MIT © Ben Evans