Recommended Free Tools
Use screenshot-desktop when you need a screenshot of the computer running your Node.js process. Install it with npm, call the Promise-based function, and receive a JPG Buffer by default. You can request PNG, save directly to a relative or absolute filename, select one monitor with listDisplays() and screen, or capture every monitor with all().
This package captures the local desktop, not a remote web page. macOS and Windows need no extra dependency according to the project documentation. Linux requires ImageMagick; the alternative scrot backend cannot select a display or control the output format.
Install screenshot-desktop
Create or open a Node.js project, then install the package:
npm install --save screenshot-desktop
The npm listing identified version 1.15.6 at the time of the cited documentation. Check npm before deployment because package versions can change. The project is MIT-licensed.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Platform prerequisites
- macOS: the README states that no additional dependency is required. macOS may still ask you to grant screen-recording permission to the terminal, IDE, or packaged application that runs Node.
- Windows: the README states that no additional dependency is required. Run the process in the same logged-in desktop session whose screen you intend to capture.
- Linux: install ImageMagick. The package also exposes a Linux-only
linuxLibraryoption acceptingimagemagickorscrot. Use ImageMagick whenever you need PNG/JPG selection or a particular monitor; the README says scrot supports neither format nor screen selection.
Capture the entire desktop in Node.js
The simplest call captures the local machine’s desktop. It returns a Promise that resolves to a Buffer containing JPG data by default.
const screenshot = require('screenshot-desktop')
screenshot()
.then((img) => {
// img is a Buffer containing JPG data
console.log(`Captured ${img.length} bytes`)
})
.catch((err) => {
console.error('Screenshot failed:', err)
})
Use async/await when the capture is part of a larger workflow:
const screenshot = require('screenshot-desktop')
async function captureDesktop() {
try {
const image = await screenshot()
console.log('Screenshot buffer:', image.length, 'bytes')
return image
} catch (error) {
console.error(error)
throw error
}
}
captureDesktop()
A successful default call gives you image bytes in memory. You can send that buffer to an HTTP response, attach it to a test artifact, or write it yourself with Node’s filesystem APIs.
Choose PNG or JPG output
The documented format values are png and jpg. JPG is the default. PNG is useful when you need lossless pixels, sharp text, or transparent areas produced by the underlying desktop capture; JPG is generally smaller for photographic screens.
const screenshot = require('screenshot-desktop')
screenshot({ format: 'png' }).then((img) => {
// img is a Buffer containing PNG data
})
Choose the format before the capture. The package does not document additional formats, quality controls, cropping, annotation, OCR, or video recording.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Save a screenshot directly to a file
Pass filename to have the package write the image. Relative and absolute paths are accepted. When saving, the Promise resolves to the absolute output path.
const screenshot = require('screenshot-desktop')
screenshot({ filename: 'shot.jpg' })
.then((imgPath) => {
console.log('Saved to:', imgPath)
})
.catch(console.error)
An absolute path works as well:
const screenshot = require('screenshot-desktop')
screenshot({ filename: '/Users/brian/Desktop/demo.png', format: 'png' })
.then((imgPath) => console.log(imgPath))
On Windows, use a correctly escaped path such as C:\Users\Sam\Desktop\demo.png, or use path.join() to avoid separator mistakes. Ensure the destination directory already exists and that the Node process has write permission.
Select a particular monitor
First enumerate connected displays. Each item contains an id and name. Pass the chosen ID to the screen option.
const screenshot = require('screenshot-desktop')
async function captureLastDisplay() {
const displays = await screenshot.listDisplays()
if (!displays.length) {
throw new Error('No displays were returned')
}
console.table(displays)
const selected = displays[displays.length - 1]
const file = await screenshot({
screen: selected.id,
format: 'png',
filename: 'display.png'
})
console.log(`Captured ${selected.name} at ${file}`)
}
captureLastDisplay().catch(console.error)
Do not assume display IDs are stable across reboots, docking changes, virtual displays, or remote sessions. Query the list at runtime and let a user or configuration select the returned ID. The documented API targets a display; it does not document a window or rectangular-region selector.
Capture every connected display
Use all() when you need one image per monitor:
const screenshot = require('screenshot-desktop')
screenshot.all()
.then((images) => {
images.forEach((buffer, index) => {
console.log(`Display ${index}: ${buffer.length} bytes`)
})
})
.catch(console.error)
The helper resolves to an array of buffers, one for each screen. If files are required, write each buffer yourself or run individual captures with the display IDs returned by listDisplays(). Keep the array order associated with the display metadata if your application needs to label files reliably.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Linux backend choice
On Linux, the package documents linuxLibrary as the backend switch:
const screenshot = require('screenshot-desktop')
screenshot({
linuxLibrary: 'imagemagick',
screen: 0,
format: 'png',
filename: 'linux-screen.png'
}).then(console.log).catch(console.error)
ImageMagick is the practical choice for the documented controls. Selecting scrot may work for a basic capture, but the README specifically notes that scrot does not support format or screen selection. A headless Linux server, container, SSH session without a graphical display, or Wayland setup may also lack a capturable desktop; the package documentation does not promise support for those environments.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Build a reusable capture script
This example accepts a path and optional display ID from environment variables, creates a PNG, and reports actionable errors:
const screenshot = require('screenshot-desktop')
const path = require('node:path')
async function main() {
const output = path.resolve(process.env.OUTPUT || 'artifacts/desktop.png')
const screen = process.env.SCREEN_ID
const options = {
filename: output,
format: 'png'
}
if (screen !== undefined) options.screen = screen
if (process.platform === 'linux') options.linuxLibrary = 'imagemagick'
try {
const saved = await screenshot(options)
console.log(`Screenshot saved at ${saved}`)
} catch (error) {
console.error('Unable to capture the desktop.')
console.error(error.message)
process.exitCode = 1
}
}
main()
Create artifacts before running this script, or change OUTPUT to an existing directory. A filename does not create missing parent folders.
Troubleshoot common failures
“Cannot find module ‘screenshot-desktop’”
Install the dependency in the project from which the script runs, then verify that you are using the same project directory and Node environment. A global npm installation does not satisfy a local require() in the usual project setup.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Linux reports a missing command or ImageMagick error
Install ImageMagick using your distribution’s package manager and ensure its executable is on PATH. Explicitly set linuxLibrary: 'imagemagick' when you need display or format selection. If you select scrot, remove expectations of those controls.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesThe output file cannot be written
Check that the parent directory exists, the path is valid for the operating system, and the user running Node can write there. Prefer an absolute path while diagnosing permission problems.
The wrong monitor is captured
Call listDisplays() immediately before the capture, print each returned id and name, and pass the selected ID. Do not hard-code an ID discovered on a different machine.
The capture fails in CI, Docker, or SSH
This library captures a local graphical desktop. A non-interactive or headless process may have no display server, and a remote shell may be attached to a different session. Run the process inside an active desktop session with the platform’s required permissions, or use a browser/API screenshot service for remote pages instead.
macOS returns a permissions error
Grant screen-recording access to the application launching Node (for example, Terminal, your IDE, or the packaged app), then restart that application and retry. Permission labels can vary by macOS release.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Performance, reliability, and design choices
- Buffer versus filename: a buffer is convenient for uploads and tests but consumes memory proportional to image size. Direct filenames avoid an extra application-level write and are simpler for artifacts.
- One display versus all: capture only the required screen to reduce work and storage.
all()intentionally returns one buffer per display, so memory use grows with monitor count and resolution. - Format: use PNG for exact pixels and JPG when smaller files are more important. The package documents no JPG quality option.
- Timing: screenshot-desktop captures the current desktop; it does not wait for a webpage, click controls, hide overlays, or load lazy content. Coordinate your own application state before calling it.
- Security: a desktop screenshot can include credentials, notifications, customer data, or other windows. Restrict output permissions and avoid logging image buffers.
Or skip the browser setup:
If what you really need is a clean image of a public webpage rather than the physical desktop, ScreenshotNeo provides a one-call website screenshot API. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Use the API documentation at https://screenshotneo.com/docs/ for the complete option set. This Node.js call saves the returned image:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' }); const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo supports full-page captures with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PNG/JPEG/WebP or PDF, custom CSS and JavaScript, clicks, selector/delay/network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, easing migrations.
There is a free allowance of 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Create a free ScreenshotNeo account to get started.
Screenshot-desktop versus a website screenshot API
| Need | Best fit | Reason |
|---|---|---|
| Capture the monitor running Node | screenshot-desktop |
It reads the local desktop and can target one or all connected displays. |
| Capture a remote URL | ScreenshotNeo | It renders a webpage through an API and removes common consent and overlay clutter. |
| Capture a specific desktop window or region | Not documented by screenshot-desktop | The documented options cover filename, format, Linux backend, display selection, and all-display capture only. |
| Generate PDFs, run asynchronous jobs, or integrate AI agents | ScreenshotNeo | Those capabilities are provided by its PDF, async/webhook, and MCP tools. |
Frequently Asked Questions
Does screenshot-desktop capture a browser tab only?
No. Its documented purpose is capturing the local machine’s desktop. The API does not document browser-tab, window, or rectangular-region capture.
Can I choose a JPEG quality level?
The documented format controls are only png and jpg; a JPG quality option is not documented.
Will display IDs remain the same after reconnecting a monitor?
Do not rely on that. Query listDisplays() at runtime because docking, virtual displays, and session changes can alter the returned IDs.
Is screenshot-desktop suitable for a server with no graphical session?
It is designed for a local machine desktop. A headless server, container, or SSH session without an available display may fail; use an active graphical session or a remote webpage screenshot service instead.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

