Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallUse github.com/kbinani/screenshot when you need a Go program to capture the local desktop. It exposes active-display enumeration, display bounds, rectangular capture, and an image.Image that you can encode with Go’s standard image/png package. The core pattern is: enumerate displays, obtain each display’s rectangle, call CaptureRect, and write the returned image to a file.
This captures pixels from the machine running your program. It is different from taking a screenshot of a web URL on a remote browser, and it is also different from recording a continuous video stream.
Install the focused screenshot package
Create a module and add the package:
mkdir go-desktop-shot
cd go-desktop-shot
go mod init example.com/go-desktop-shot
go get github.com/kbinani/screenshot
The project README lists Windows, Darwin, Linux, FreeBSD, OpenBSD, and NetBSD targets, supports multiple displays, and is cgo-free except for Darwin. Check the current README for release-specific requirements before shipping.
Capture every active display
The following complete program saves one PNG per active display. It deliberately gets the display bounds instead of assuming that every monitor starts at (0, 0).
Recommended Free Tools
#1 Best Overall
- [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
- [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
- [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
- [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
- [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
package main
import (
"fmt"
"image/png"
"os"
"github.com/kbinani/screenshot"
)
func main() {
n := screenshot.NumActiveDisplays()
if n == 0 {
fmt.Println("no active displays found")
return
}
for i := 0; i < n; i++ {
bounds := screenshot.GetDisplayBounds(i)
img, err := screenshot.CaptureRect(bounds)
if err != nil {
fmt.Fprintf(os.Stderr, "capture display %d (%v): %vn", i, bounds, err)
os.Exit(1)
}
filename := fmt.Sprintf("display-%d.png", i)
file, err := os.Create(filename)
if err != nil {
fmt.Fprintf(os.Stderr, "create %s: %vn", filename, err)
os.Exit(1)
}
if err := png.Encode(file, img); err != nil {
file.Close()
fmt.Fprintf(os.Stderr, "encode %s: %vn", filename, err)
os.Exit(1)
}
if err := file.Close(); err != nil {
fmt.Fprintf(os.Stderr, "close %s: %vn", filename, err)
os.Exit(1)
}
fmt.Printf("saved %s (%v)n", filename, bounds)
}
}
Run it with go run .. A successful run creates files such as display-0.png and reports each rectangle. The PNG encoder accepts the image returned by CaptureRect; no conversion to a custom bitmap type is required.
Why the bounds call matters
The package documents an origin at the upper-left of the main display, with the y-axis increasing downward. A monitor positioned above or left of the main display therefore has negative coordinates. For example, a secondary display might have a rectangle beginning at x=-1920. Passing the exact rectangle returned by GetDisplayBounds lets the library capture that monitor correctly.
Capture a region instead of a whole monitor
CaptureRect accepts any rectangle in the desktop coordinate space. Define a region and encode it the same way:
package main
import (
"image"
"image/png"
"log"
"os"
"github.com/kbinani/screenshot"
)
func main() {
// Coordinates are desktop coordinates, not coordinates relative to display 0.
region := image.Rect(100, 100, 900, 700)
img, err := screenshot.CaptureRect(region)
if err != nil {
log.Fatal(err)
}
file, err := os.Create("region.png")
if err != nil {
log.Fatal(err)
}
defer file.Close()
if err := png.Encode(file, img); err != nil {
log.Fatal(err)
}
}
For a region on a monitor whose origin is negative, use those negative desktop coordinates. Validate that the rectangle has the intended width and height before capturing; an accidentally empty or off-screen rectangle is a common source of failures.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- Model: Dell OptiPlex 7050 Small Form Factor (SFF)
- Processor: Intel Core i7-7700 3.60 GHz
- Memory: 32GB DDR4 Ram
- Storage: 1TB Solid State Drive (SSD) Fast Boot + Storage
- Operating System: Windows 11 Pro (64-bit)
Choose the right Go approach
Use kbinani/screenshot for capture-only tools
The focused package is a good fit for a utility, test helper, support command, or desktop screenshot feature. Its documented workflow covers display enumeration, bounds, rectangular capture, and PNG encoding without requiring a larger automation framework. It also explicitly demonstrates multi-display geometry.
Use RobotGo when capture is part of automation
RobotGo’s package documentation exposes Capture and CaptureImg alongside mouse, keyboard, window, process, image, and bitmap functions. Its screen example shows full-screen and region capture, saving output, and iterating over displays. Choose it when the same application must also control input or windows; for capture alone, compare its additional dependencies and backend setup with the focused package.
RobotGo’s upstream README describes environment-sensitive Linux backends. Its wlroots-oriented Wayland path depends on protocols such as zwlr_screencopy_v1; GNOME and KDE setups may use different portal/libei paths with different capture support. The README also states that macOS capture requires Screen Recording permission. These details vary by RobotGo release, compositor, build tags, and desktop session, so check the documentation for the exact environment you deploy.
| Question | Focused screenshot package | RobotGo |
|---|---|---|
| Primary scope | Desktop capture | Capture plus input, window, process, image, and bitmap automation |
| Capture API | NumActiveDisplays, GetDisplayBounds, CaptureRect |
Capture and CaptureImg, with screen examples |
| Multi-display geometry | Documented display bounds and negative-coordinate examples | Screen example iterates over displays |
| Linux considerations | Verify the package’s support for your session | Wayland compositor protocols and portal/libei choices can affect support |
| macOS consideration | Verify current package behavior | Screen Recording permission is required according to the upstream README |
Permissions, sessions, and deployment checks
- macOS: grant the executable or host application Screen Recording permission when the operating system prompts or blocks capture. If you rebuild or change the binary identity, review the permission again.
- Linux X11 versus Wayland: a program that works under X11 may not work identically under Wayland. Compositor protocols, desktop portals, and the selected library backend determine what is available.
- Remote sessions and services: a headless service may have no active display. Test the same logged-in session, display server, and permissions used in production.
- Multiple monitors: never hard-code a single positive coordinate system. Log every display rectangle and keep output names stable when you need to match files to monitors.
Encoding, file safety, and useful extensions
Always close output files
Check errors from os.Create, png.Encode, and Close. Encoding can succeed while a later close reports a storage error. For repeated captures, generate unique names or write to a controlled directory so one monitor cannot overwrite another.
Rank #3
- IMMERSIVE 24 INCH DISPLAY: Experience stunning clarity on a Full HD IPS screen with ultra-thin bezels, offering a 90% screen-to-body ratio that makes everything from spreadsheets to streaming come alive with vibrant colors and crisp details.
- POWERFUL INTEL PROCESSING: Tackle demanding tasks with ease thanks to the Intel processor and 16GB of high-speed memory, delivering smooth performance whether you're multitasking between applications or running productivity software.
- GENEROUS STORAGE: Store all your important files, photos, and programs with blazing-fast solid state drive technology that ensures quick boot times, rapid file access, and plenty of space for your digital life.
- ENHANCED PRIVACY AND COLLABORATION: Work confidently with the pop-up privacy camera that tucks away when not in use, plus dual microphones with noise reduction for crystal-clear video calls that keep you connected professionally.
- ECO-CONSCIOUS DESIGN: Feel good about your purchase with an EPEAT Gold registered and ENERGY STAR certified computer that combines premium performance with responsible environmental manufacturing practices.
PNG versus other formats
The documented examples use PNG because the standard library can encode the returned image directly and PNG is lossless. If your application needs another format, use an encoder that accepts an image.Image, and make the format choice explicit in your file extension and error handling.
Repeated screenshots are not automatically a video feed
A loop that calls CaptureRect repeatedly produces individual frames. A live screen feed additionally needs timing, buffering, an encoding strategy, and transport or containerization. Decide the target frame rate and latency before designing that system; a screenshot utility should not imply video performance that the package documentation does not publish.
Troubleshooting common failures
“No active displays found”
The process may be running without an attached or logged-in graphical session. Run it inside the desktop session you intend to capture, and log the operating system and display-server context.
Permission denied or a blank image on macOS
Open the system privacy settings and grant Screen Recording access to the terminal, IDE, or compiled application that is actually launching the Go program. Restart the affected process after changing permission.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #4
- This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box. Only select sellers who maintain a high-performance bar may offer Certified Refurbished products on Amazon.com.
- Dell Optiplex 3050 SFF Desktop computer PC, Intel Quad Core i5-6500 up to 3.6GHz, 16GB DDR4, 256GB SSD
- Includes: USB Keyboard & Mouse, USB WiFi adapter, Microsoft office 30 days free trail.
- Port: Front: USB 3.0(2), USB 2.0(2); Rear: DP, HDMI, USB 3.0(2), USB 2.0(2), RJ-45.
- Support 4K (3840x2160) Dual display, makes it easy to connect two monitors at the same time, and you can expand working Windows, mirror content, or expand a single window across multiple monitors.
Wayland capture fails while X11 worked
Check the library and, for RobotGo, the current backend documentation for your compositor. Confirm required protocols or portal support, build tags, and whether the session is GNOME, KDE, wlroots-based, or another environment.
The wrong monitor or region is captured
Print the values returned by GetDisplayBounds. A monitor above or left of the primary display can have negative x or y values. Use those coordinates directly instead of translating them to positive numbers.
The output file is empty or truncated
Check every file and encoding error, ensure the destination directory exists and is writable, and close the file after encoding. Avoid reusing one filename when capturing several displays unless overwriting is intentional.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup:
If the thing you need is a screenshot of a public or authenticated web page, rather than the local desktop, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one API request. It is not a replacement for local-display capture, but it avoids installing a browser automation stack for URL screenshots.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Best Value
- Connectivity: Includes WiFi, Bluetooth, and LAN for wireless and wired connections
- Memory: Features 16GB DDR4 RAM for smooth multitasking and performance
- Storage: Combines 500GB SSD and 1TB HDD for ample storage space
- Graphics: Integrated Intel UHD Graphics 630 for crisp visuals and video playback
- Design: Sleek desktop tower with black color and slim profile for modern look
Use the URL-encoded cURL call shown below; the parameter names used by other screenshot APIs also work.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Go developers can call the same endpoint directly:
package main
import (
"io"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
q.Set("access_key", "YOUR_API_KEY")
q.Set("url", "https://stripe.com")
res, err := http.Get("https://api.screenshotneo.com/v1/shot?" + q.Encode())
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode < 200 || res.StatusCode >= 300 {
log.Fatalf("ScreenshotNeo returned %s", res.Status)
}
file, err := os.Create("shot.webp")
if err != nil {
log.Fatal(err)
}
defer file.Close()
if _, err := io.Copy(file, res.Body); err != nil {
log.Fatal(err)
}
}
See the ScreenshotNeo documentation for the full option set. Before capture it accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Other available controls include full-page capture with lazy images, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper and margin settings, custom CSS and JavaScript, clicks, selector or network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Plans include 1,000 free shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Frequently asked implementation questions
Can I capture one window by title?
The focused package documents display and rectangle capture, not window-title selection. Obtain a window rectangle through a suitable window-automation layer, then pass that rectangle to CaptureRect, or use RobotGo when window automation is already part of the application.
Free tools Windows power users keep installed
One-click scans. No signup required.
Does this capture all monitors as one image?
The documented workflow captures each active display separately. You can later compose those images onto a larger canvas, but you must account for each display’s bounds, including negative coordinates and differing sizes.
Is a capture card required?
No. A capture card is for an external video signal. These Go APIs read the desktop exposed by the local operating system.
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.




