https://github.com/kuzat/screenshot-node
Takes a screenshot of selected area and saves it to disk
https://github.com/kuzat/screenshot-node
cross-platform linux macos screenshot screenshot-node windows
Last synced: 12 months ago
JSON representation
Takes a screenshot of selected area and saves it to disk
- Host: GitHub
- URL: https://github.com/kuzat/screenshot-node
- Owner: Kuzat
- License: mit
- Created: 2017-03-14T20:26:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T08:42:54.000Z (almost 6 years ago)
- Last Synced: 2025-04-09T07:36:59.866Z (about 1 year ago)
- Topics: cross-platform, linux, macos, screenshot, screenshot-node, windows
- Language: C++
- Size: 22.5 KB
- Stars: 23
- Watchers: 4
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# screenshot-node [](https://www.npmjs.com/package/screenshot-node)
Takes a screenshot of selected area and saves it to disk.
# Linux, OS X and Windows all supported now.
## Instalation
```sh
$ npm install screenshot-node
```
# Methods
call the module
```javascript
var screenshot = require('screenshot-node');
```
### screenshot.saveScreenshot(x, y, width, height, path, callback)
#### x, y
##### Must be whole numbers.
The x and y coordinates for the top left corner of the picture.
#### width, height
##### Must be whole numbers.
The width and height of the screenshot in pixels.
##### Set width and height as 0 to take a fullscreen screenshot
#### path
##### Must be a string
The path including name of the file you want the screenshot to be saved as.
#### callback(err)
A string with error message. Null if there are no error.
#### example
Takes a screenshot from top left corner that have a width and height of 100. Saves it in the current directory with the name "image.png".
```javascript
screenshot.saveScreenshot(0, 0, 100, 100, "image.png", (err) => {
if(err) console.log(err);
}
```