DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
Computer Vision

How to Take Screenshots with DXcam in Python on Windows

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install DXcam, create a camera, and call grab() to capture a screen frame as a NumPy array. DXcam is a Windows capture library: its project documentation describes Desktop Duplication (DXGI) as the default backend and recommends starting there for most workloads. A one-shot capture is different from DXcam’s threaded, buffered mode for continuous frame streams.

Take a one-shot screenshot

Install DXcam in the Python environment that will run your script:

python -m pip install dxcam

Then create a camera, grab the current frame, and let the context manager release the capture resource:

import dxcam

with dxcam.create() as camera:
    frame = camera.grab()

if frame is None:
    print("No new frame was available")
else:
    print(type(frame), frame.shape, frame.dtype)

The returned frame is a NumPy array, not a filename or an image displayed in a window. DXcam’s documentation notes that grab() can return None if no new frame has been available since the preceding capture. For a script that needs a frame even when the display has not changed, call grab(new_frame_only=False).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

The context manager is the concise cleanup pattern documented by the project. If you manage the camera without it, call camera.release() when finished. Release stops capture and frees buffers and resources; a released camera instance cannot be reused.

Save the frame as an image

DXcam returns pixels in memory. To write a PNG file, install Pillow and save the array. This example uses DXcam’s RGB output setting so the channel order matches what Pillow expects:

python -m pip install "dxcam[cv2]" pillow
import dxcam
from PIL import Image

with dxcam.create(output_color="RGB") as camera:
    frame = camera.grab(new_frame_only=False)

if frame is None:
    raise RuntimeError("DXcam did not return a frame")

Image.fromarray(frame).save("screenshot.png")

For other output modes, verify the channel order expected by the library that consumes the array. DXcam documents RGB, RGBA, BGR, BGRA, and GRAY output. An array with BGR channels, for example, should not be treated as RGB without conversion or the colors will be wrong. OpenCV pipelines often use BGR; image display and save libraries may expect RGB or RGBA.

The project documents BGRA as the leanest dependency path. Other color conversion modes require OpenCV or the compiled NumPy processor path, according to the README. The optional cv2 extra installs OpenCV support. Install winrt as well if you intend to use that backend:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
python -m pip install "dxcam[cv2,winrt]"

Capture only part of the screen

Pass region=(left, top, right, bottom) to grab(). These are the rectangle’s boundary coordinates—not an origin followed by width and height.

import dxcam

with dxcam.create() as camera:
    frame = camera.grab(region=(100, 80, 740, 720))

if frame is None:
    raise RuntimeError("No frame was available")
print(frame.shape)

The rectangle above begins at horizontal coordinate 100 and vertical coordinate 80, and ends at 740 and 720. It therefore describes a 640-by-640 area. The coordinates refer to the capture output; check the target output’s dimensions before choosing boundaries, particularly if you are capturing a different monitor or output.

Choose between a still capture and a frame stream

Use grab() when the task is to take a still image on demand. Use start(), get_latest_frame(), and stop() when a computer-vision or video workflow needs repeated frames. The continuous mode runs a capture thread and keeps frames in an in-memory ring buffer.

import time
import dxcam

camera = dxcam.create()
camera.start(region=(100, 80, 740, 720), target_fps=60)
try:
    for _ in range(10):
        frame = camera.get_latest_frame()
        if frame is not None:
            # Process the NumPy array here.
            print(frame.shape)
        time.sleep(1 / 60)
finally:
    camera.stop()
    camera.release()

This example asks DXcam to capture at a target rate of 60 frames per second, but the actual capture cadence depends on the machine and workload. Retrieve and process frames at a rate appropriate to the application; the in-memory ring buffer is not a way to persist every frame indefinitely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

With video_mode=True, the documented behavior is to fill the buffer at the requested target frame rate and reuse the previous frame when the display has not rendered a new one. That can be useful for a paced video or ML loop that needs a frame on each interval. It is not the same as asking whether a fresh screen update exists: for one-shot capture, the new_frame_only behavior is the relevant choice.

Select a backend and output

DXcam documents two backends: dxgi, based on Desktop Duplication and used by default, and winrt, based on Windows Graphics Capture. The project recommends beginning with DXGI for most workloads, especially one-shot grabs, and trying WinRT if cursor rendering is needed or if it better fits the application’s constraints. There is no documented universal winner across every Windows machine and application.

Backend behavior and suitability can depend on the target application and system. If DXGI does not fit your cursor or application requirements, try the documented WinRT backend with the optional dependency installed, then check the result in the actual workflow:

import dxcam

camera = dxcam.create(backend="winrt")
try:
    frame = camera.grab(new_frame_only=False)
finally:
    camera.release()

The project associates each output or monitor with a camera instance and demonstrates choosing device and output indices for multi-monitor or multi-GPU systems. If capture appears to come from the wrong display, inspect the available device/output choices in the version of DXcam you installed and select the intended indices rather than assuming the primary monitor is the target.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Installation and compatibility notes

DXcam’s project listing documents Python 3.10 or newer and Windows classifiers. Its README says official Windows wheels are built for CPython 3.10 through 3.14. Those are project-maintained compatibility details that can change as releases evolve; if installation fails on a newer Python release or a nonstandard interpreter, check the package’s current installation metadata and available wheels.

The minimal installation is python -m pip install dxcam. Add optional extras only for the features you need: cv2 for OpenCV-based color conversion, and winrt for Windows Graphics Capture support. Keeping the dependencies minimal can avoid installing image-processing or backend packages your script will not use.

Troubleshoot common capture problems

  • ModuleNotFoundError: No module named 'dxcam': Install DXcam into the same interpreter or virtual environment used to run the script. Using python -m pip install dxcam ties pip to the named Python executable.
  • grab() returns None: The API may have no new frame since the previous capture. If the script needs the latest screen contents regardless of whether they changed, call grab(new_frame_only=False) and still check for None before processing.
  • The saved image has unexpected colors: Check output_color and the consumer’s expected channel order. Convert or request RGB for a Pillow-style image path, or use the channel ordering expected by an OpenCV pipeline.
  • The captured rectangle is shifted or has unexpected dimensions: DXcam’s region tuple is (left, top, right, bottom). It is not (x, y, width, height); compute the right and bottom boundaries and ensure they fall within the intended output.
  • Cursor or application compatibility is unsuitable: DXGI is the default starting point. If cursor rendering is required or DXGI does not suit the application, install the WinRT extra and try backend="winrt" on the target system.
  • Capture fails after cleanup: A released camera instance is not reusable. Create a new camera for a later capture, or keep the original instance active until its work is complete.
  • Continuous capture does not behave like a one-shot read: The threaded mode maintains an in-memory ring buffer. Use grab() for an on-demand still, and call stop() when the stream is done.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

DXcam describes itself as a high-performance Python screenshot and capture library for Windows based on Desktop Duplication. The project README, updated in 2026, states “240+fps on 1080p.” That is the project’s own claim, not an independently established benchmark or a guaranteed rate for a particular PC, output, backend, or workload. Treat throughput as something to measure in the capture and processing pipeline you plan to run.

For reliability, handle absent frames, clean up camera resources, and test the selected monitor, backend, and color mode in the actual target application. Still captures and continuous capture have different behavior and resource use: a stream runs a capture thread and buffers frames in memory, while a one-shot call is simpler when only a single frame is required. DXcam is software distributed through pip; there is no separate hardware purchase required by the documented capture method.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Or skip the browser setup

DXcam captures a Windows screen. If what you need is a screenshot of a public webpage rather than the pixels on your desktop, ScreenshotNeo is a website screenshot API and MCP server for developers. It takes a URL and returns a PNG, JPEG, WebP, or PDF. The one-call cURL example below saves a WebP screenshot; see the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses include X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

Frequently Asked Questions

Can DXcam capture a screenshot on macOS or Linux?

The documented package targets Windows. Use a capture library appropriate to the operating system if your script must run on macOS or Linux.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does DXcam return a screenshot file?

No. It returns a NumPy array; use an image library such as Pillow to save the pixels to a file.

Can DXcam capture more than one monitor?

The project documents selecting device and output indices and associates outputs with camera instances. Select the indices corresponding to the monitor you intend to capture.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.