Screencap mss
Grab your screen straight into a workflow
- image
Screencap mss captures a rectangle of your screen, defined by pixel coordinates, and hands it back as an IMAGE. That's it - no window picker, no app targeting, just "grab this box of pixels." The unglamorous job description hides a genuinely fun use case: paired with auto-queue, it turns ComfyUI into a live screen-to-image pipeline.
Why you'd use it
The obvious use is quick capture-and-generate: point it at a region of your screen - a drawing app canvas, a game window, an OBS preview, another program entirely - and feed that capture into an image or video model instead of manually screenshotting and importing a file every time. But the description spells out the real intent: it's built for realtime diffusion with autoqueue. Set ComfyUI to auto-queue, wire this node's output through a fast model and sampler, and you get a live loop - draw or move something on screen, watch the generated output update a beat later. It's the same family of demo people build with real-time Photoshop-to-Stable-Diffusion pipelines, minus the extra plumbing those setups usually need - this node is the screen-grab step, built in.
The mss in the class name isn't decoration - it's naming the underlying Python library the node wraps, a small, fast, cross-platform screenshot library. That's why this capture is quick enough to be usable in a tight auto-queue loop instead of a slow, general-purpose screenshot tool.
The inputs and outputs that matter
x,y(default 0) - the top-left corner of your capture region, in screen pixel coordinates.width,height(default 512 each) - the size of the capture box.num_frames(default 1, up to 255) - grab more than one frame in a single call, useful if you want a short burst rather than a single still.delay(default 0.1 seconds) - the pause between frames whennum_framesis greater than 1.imageout - the captured region (or frame batch, ifnum_frames> 1), ready to feed into the rest of your graph.
Installing it
Ships with the pack:
- ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, thenpip install -r ComfyUI-KJNodes/requirements.txt, restart.
mss itself is a lightweight dependency pulled in with the rest of the pack's requirements - nothing heavy, no models to download.
Common issues & troubleshooting
Capturing the wrong area, or blank/black frames. On a multi-monitor setup, x/y coordinates are absolute across your whole desktop layout, not relative to whichever monitor you think is "screen one" - a region that looks right conceptually can land on the wrong physical monitor if your displays aren't arranged the way you assumed. Double-check your coordinates against your actual monitor arrangement rather than guessing.
Nothing captures at all on Linux. Screen-capture libraries like mss rely on OS-level screenshot APIs that X11 exposes and Wayland deliberately restricts for security reasons. If you're on a Wayland session and getting empty or failed captures, that's a platform limitation of screen capture in general on Wayland, not something specific to this node - running under X11 (or an XWayland-compatible setup) is the usual workaround.
Auto-queue loop feels laggy or falls behind. num_frames and delay add up fast - a burst of several frames per capture plus whatever your model and sampler take per generation can easily outpace what "realtime" should mean. Keep num_frames at 1 and lean on a fast, low-step model/sampler combo if you're chasing an actually-live feel rather than a slideshow.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| x | INT | 00–10000 | — |
| y | INT | 00–10000 | — |
| width | INT | 5120–10000 | — |
| height | INT | 5120–10000 | — |
| num_frames | INT | 11–255 | — |
| delay | FLOAT | 0.100–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |