screenshot-desktop
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/screenshot-desktop package

1.15.1 • Public • Published

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) => {
  // img: Buffer filled with jpg goodness
  // ...
}).catch((err) => {
  // ...
})
const screenshot = require('screenshot-desktop')

screenshot({format: 'png'}).then((img) => {
  // img: Buffer filled with png goodness
  // ...
}).catch((err) => {
  // ...
})
screenshot.listDisplays().then((displays) => {
  // displays: [{ id, name }, { id, name }]
  screenshot({ screen: displays[displays.length - 1].id })
    .then((img) => {
      // img: Buffer of screenshot of the last display
    });
})
screenshot.all().then((imgs) => {
  // imgs: an array of Buffers, one for each screen
})
screenshot({ filename: 'shot.jpg' }).then((imgPath) => {
  // imgPath: absolute path to screenshot
  // created in current working directory named shot.png
});

// absolute paths work too. so do pngs
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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.15.146,124latest

Version History

VersionDownloads (Last 7 Days)Published
1.15.146,124
1.15.011,373
1.14.132
1.14.0564
0.0.0-development163
1.12.72,082
1.12.62
1.12.53
1.12.45
1.12.317
1.12.27
1.12.14
1.12.026
1.11.0453
1.10.09
1.9.017
1.8.02
1.7.05
1.6.12
1.6.02
1.5.53
1.5.42
1.5.32
1.5.22
1.5.12
1.5.02
1.4.32
1.4.26
1.4.13
1.4.02
1.3.13
1.3.03
1.2.04
1.1.012
1.0.03

Package Sidebar

Install

npm i screenshot-desktop

Weekly Downloads

60,943

Version

1.15.1

License

MIT

Unpacked Size

39.8 kB

Total Files

17

Last publish

Collaborators

  • bencevans