October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk6 min

How to Take Screenshots with Python and DXcam on Windows

Install DXcam on Windows, capture a screen frame as a NumPy array, crop a region, or read frames continuously—with practical backend, format, and troubleshooting guidance.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install DXcam with pip install dxcam, create a camera with dxcam.create(), then call camera.grab(). The result is a NumPy array containing a captured screen frame. DXcam is designed for Windows, not a cross-platform screenshot workflow.

Install DXcam and capture one screenshot

Use a Windows Python environment and install the package:

As an Amazon Associate I earn from qualifying purchases.

python -m pip install dxcam

Then capture a frame. A context manager releases capture resources when the block ends:

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

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

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

DXcam documents grab() as returning a NumPy array, or None if no new frame has appeared since the previous capture. To request the current frame even when it has not changed, pass new_frame_only=False:

#1 Best Overall
frame = camera.grab(new_frame_only=False)

The project describes DXcam as a high-performance Python screenshot and capture library for Windows based on the Desktop Duplication API. Windows’ Desktop Duplication API provides applications access to desktop contents, including across monitor boundaries; see Microsoft Learn’s Desktop Duplication documentation.

Capture only part of the screen

Pass region=(left, top, right, bottom) to grab(). The coordinates describe a rectangle in desktop coordinates, and the returned array contains that crop:

import dxcam

left, top, right, bottom = 100, 100, 900, 700

with dxcam.create() as camera:
    frame = camera.grab(region=(left, top, right, bottom))

Choose coordinates using the actual display layout and dimensions. A crop outside the intended display area may not represent the region you expect; do not assume every desktop is 1920×1080.

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

Continuously read the newest frame

For repeated capture, start DXcam’s polling thread, read frames from its in-memory ring buffer, and stop capture when finished. Use try/finally so an exception does not leave capture running:

import dxcam

camera = dxcam.create()
camera.start(target_fps=60)
try:
    while True:
        frame = camera.get_latest_frame()
        if frame is not None:
            # Process or copy the frame before the next iteration as needed.
            pass
finally:
    camera.stop()
    camera.release()

get_latest_frame(with_timestamp=True) returns the frame together with a timestamp:

frame, timestamp = camera.get_latest_frame(with_timestamp=True)

The documented ring buffer defaults to 8 frames. Set max_buffer_len when creating the camera if your consumer needs a different buffer capacity. Frames are held in memory; once the buffer fills, newer frames overwrite older ones, so a slow consumer should not expect to process every frame.

Rank #2
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

For a video-oriented loop, video_mode=True makes the buffer fill at the requested target FPS by repeating the previous frame when the desktop has not rendered a new one. That can provide a regular frame cadence, but repeated frames are not new screen changes; choose based on whether your pipeline needs a fixed-rate sequence or only genuinely updated desktop frames.

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

Choose a capture backend

DXcam documents two backends. DXGI is its default Desktop Duplication path and the project’s recommended starting point for most workloads, especially one-shot captures. WinRT uses Windows Graphics Capture and is worth trying when cursor rendering is needed or its application constraints or observed performance better fit your use case. The documentation does not establish a universal performance winner across machines.

Select a backend when creating the camera, for example dxcam.create(backend="winrt"); otherwise the default is DXGI. Compare the result in the actual application and display setup you intend to capture.

Select the frame color format

DXcam obtains BGRA frames and can process them into RGB, RGBA, BGR, BGRA, or GRAY output. The README recommends the OpenCV processor when OpenCV is installed and NumPy otherwise. BGRA is the leanest dependency path and avoids requiring OpenCV for conversion. If writing video with OpenCV, the project’s example uses BGR output.

camera = dxcam.create(output_color="BGR")

Use the format expected by the next step in your pipeline; otherwise colors may be interpreted in the wrong channel order. Check the project README for the current processor and output configuration details: DXcam on GitHub.

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.

Python and Windows compatibility

The DXcam README lists official Windows wheels for CPython 3.10 through 3.14. Package availability changes over time, so if installation fails, check the current DXcam files on PyPI and the project’s installation notes for your Python version and Windows architecture.

Rank #3
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.

Performance and reliability considerations

The DXcam README promotes capture throughput of “240+fps on 1080p.” This is a project-published capability claim, not an independently verified benchmark or a guarantee for a particular PC. Actual throughput depends on hardware, display configuration, backend, processing, and what the consuming loop does. Start with the simplest backend and output format that fit your task, then measure in your own workload.

  • For a single capture, use grab(); do not start a continuous polling thread unless you need a stream.
  • For sustained capture, keep processing fast enough to avoid falling behind the finite ring buffer.
  • Increase max_buffer_len only when a larger in-memory queue helps your consumer; it cannot make processing faster.
  • Use video_mode=True only when repeated frames at the target cadence are suitable for the downstream task.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common problems

grab() returns None

By default, DXcam returns None when no new frame has appeared since the last capture. If you need the latest frame regardless of whether it changed, call camera.grab(new_frame_only=False). In a continuous loop, check for None before processing a result.

DXcam will not install

Confirm you are using Windows and a supported CPython version and architecture, then compare them with the current wheel list on PyPI. The official README’s wheel compatibility can change as releases are published.

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

The crop is wrong or empty

Verify the order is (left, top, right, bottom) and that the values are desktop coordinates within the display area you mean to capture. Use the actual monitor arrangement and resolution rather than copying example dimensions.

The frame colors look incorrect

Check the selected output color against the consumer’s expected channel ordering. For example, the DXcam README uses BGR for OpenCV video writing; using RGB data where BGR is expected can swap red and blue.

Frames are skipped during continuous capture

The ring buffer holds a finite number of frames and newer ones overwrite older frames after it fills. Reduce the time spent processing each frame, consume frames more promptly, or adjust max_buffer_len to accommodate short delays. A larger buffer uses more memory and does not prevent loss if processing remains slower than capture indefinitely.

Rank #4
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.

The cursor is missing

Try the WinRT backend, which the project identifies as an option when cursor rendering is needed. Confirm the behavior in the specific Windows application and setup you are capturing.

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

Or skip the browser setup

DXcam captures the Windows desktop locally. If instead you need screenshots of web pages, ScreenshotNeo offers a one-request website screenshot API and an MCP server for AI agents. It is a different workflow from DXcam: no local desktop capture setup is needed for the API call.

Install the Python HTTP client with python -m pip install requests, then run:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

See the ScreenshotNeo API documentation for setup and options. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. AI agents can take screenshots through its MCP server. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.

Frequently Asked Questions

Can I use DXcam on macOS or Linux?

No. DXcam is a Windows-focused screen-capture library; this documented workflow is not cross-platform.

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.

Does DXcam save the screenshot as a PNG file automatically?

No. The documented capture operation returns a NumPy array. Saving or encoding that array is a separate step.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$245.99
Bestseller No. 2
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$285.00

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 *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.