
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@cc-kit/node-screenshots
Advanced tools
`node-screenshots` is a native node.js screenshot library based on [XCap](https://github.com/nashaofu/xcap), It supports Mac, Windows, and Linux systems without any dependencies. `node-screenshots` supports screenshot and video recording (to be implemente
node-screenshots is a native node.js screenshot library based on XCap, It supports Mac, Windows, and Linux systems without any dependencies. node-screenshots supports screenshot and video recording (to be implemented).
English | 简体ä¸ć–‡
| Operating System | node16 | node18 | node20 |
|---|---|---|---|
| Windows x64 | âś“ | âś“ | âś“ |
| Windows x32 | âś“ | âś“ | âś“ |
| Windows arm64 | âś“ | âś“ | âś“ |
| macOS x64 | âś“ | âś“ | âś“ |
| macOS arm64 | âś“ | âś“ | âś“ |
| Linux x64 gnu | âś“ | âś“ | âś“ |
| Linux x64 musl | âś“ | âś“ | âś“ |
const fs = require("fs");
const { Monitor } = require("node-screenshots");
let monitor = Monitor.fromPoint(100, 100);
console.log(monitor, monitor.id());
let image = monitor.captureImageSync();
fs.writeFileSync(`${monitor.id()}-sync.png`, image.toPngSync());
monitor.captureImage().then((data) => {
console.log(data);
fs.writeFileSync(`${monitor.id()}.jpeg`, data.toJpegSync());
});
const monitors = Monitor.all();
monitors.forEach((item) => {
console.log(
"Monitor:",
item.id(),
item.name(),
[item.x(), item.y(), item.width(), item.height()],
item.rotation(),
item.scaleFactor(),
item.frequency(),
item.isPrimary()
);
});
const fs = require("fs");
const { Window } = require("node-screenshots");
let windows = Window.all();
windows.forEach((item) => {
console.log({
id: item.id(),
x: item.x(),
y: item.y(),
y: item.z(),
width: item.width(),
height: item.height(),
rotation: item.rotation(),
scaleFactor: item.scaleFactor(),
isPrimary: item.isPrimary(),
});
let image = item.captureImageSync();
fs.writeFileSync(`${item.id()}-sync.bmp`, image.toBmpSync());
item.captureImage().then(async (data) => {
console.log(data);
let newImage = await data.crop(10, 10, 10, 10);
fs.writeFileSync(`${item.id()}.png`, await newImage.toPng());
});
});
Full typeScript type definition: index.d.ts
static all(): Array<Monitor>: Get all monitorstatic fromPoint(x: number, y: number): Monitor | null: Get a monitor from the specified coordinatescaptureImageSync(): Image: Synchronously capture imagecaptureImage(): Promise<Image>: Asynchronously capture imagestatic all(): Array<Window>: Get all windowcaptureImageSync(): Image: Synchronously capture imagecaptureImage(): Promise<Image>: Asynchronously capture imagecropSync(x: number, y: number, width: number, height: number): Image: Synchronously crop imagecrop(x: number, y: number, width: number, height: number): Promise<Image>: Asynchronously crop imagetoPngSync(copyOutputData?: boolean | undefined | null): Buffer:Synchronously Convert to pngtoPng(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to pngtoJpegSync(copyOutputData?: boolean | undefined | null): Buffer: Synchronously Convert to jpegtoJpeg(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to jpegtoBmpSync(copyOutputData?: boolean | undefined | null): Buffer: Synchronously Convert to bmptoBmp(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to bmptoRawSync(copyOutputData?: boolean | undefined | null): Buffer: Synchronously Convert to raw(RGBA data)toRaw(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to raw(RGBA data)copyOutputData: pass related parameters in electron, otherwise electron will crash, nodejs does not pass or passes false, performance will be better, for more information refer to https://github.com/napi-rs/napi-rs/issues/1346
On Linux, you need to install libxcb, libxrandr, and dbus.
Debian / Ubuntu:
apt-get install libxcb1 libxrandr2 libdbus-1-3
Alpine:
apk add libxcb libxrandr dbus
FAQs
`node-screenshots` is a native node.js screenshot library based on [XCap](https://github.com/nashaofu/xcap), It supports Mac, Windows, and Linux systems without any dependencies. `node-screenshots` supports screenshot and video recording (to be implemente
We found that @cc-kit/node-screenshots demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.