KJNodes/imagegenerated

Screencap mss(Screencap_mss)

This node implements screen capture based on the `mss` library, allowing precise selection of the capture area by specifying screen coordinates and region dimensions.

Screencap mss

image
x
0
y
0
width
512
height
512
num_frames
1
delay
0.10
KJNodes

The Screencap mss node implements screen capture based on the mss library, allowing precise selection of the capture area by specifying screen coordinates and region size.

The Screencap mss node is a screen capture tool that allows you to directly capture images from a specified area of your screen within a ComfyUI workflow. Its core function is to capture screen content in real-time and convert the captured image into an image data format usable by the workflow, providing input for subsequent image processing or generation steps.

Node Functionality

This node implements screen capture based on the mss library, allowing precise selection of the capture area by specifying screen coordinates and region size. It supports capturing a single image or continuously capturing multiple frames at specified intervals. The captured RGB data is automatically converted into PyTorch tensor format and ultimately output as the standard IMAGE type, which can be directly connected to other image processing nodes.

Node Parameter Description - Screencap mss

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
xINTYes00 - 10000 (Step: 1)Specifies the horizontal coordinate (X-axis) of the top-left corner of the capture area, with the top-left corner of the screen as the origin (0,0). The range is 0 to 10000, with a step of 1.
yINTYes00 - 10000 (Step: 1)Specifies the vertical coordinate (Y-axis) of the top-left corner of the capture area, with the top-left corner of the screen as the origin (0,0). The range is 0 to 10000, with a step of 1.
widthINTYes5120 - 10000 (Step: 1)Defines the width (in pixels) of the capture area. The range is 0 to 10000, with a step of 1.
heightINTYes5120 - 10000 (Step: 1)Defines the height (in pixels) of the capture area. The range is 0 to 10000, with a step of 1.
num_framesINTYes11 - 255 (Step: 1)Sets the number of consecutive image frames to capture. The range is 1 to 255, with a step of 1.
delayFLOATYes0.10.0 - 10.0 (Step: 0.01)When capturing multiple frames consecutively, sets the wait time (in seconds) between each frame. The range is 0.0 to 10.0, with a step of 0.01.

Output

Parameter NameData TypeDescription
imageIMAGEOutputs the captured screen image or image sequence (in tensor format).

Use Cases

You can use this node for real-time interactive workflows. For example, after enabling the workflow's auto-queue function and connecting it to an image generation model, you can achieve "what you see is what you get" real-time style transfer or content repainting. It can also be used to record a short segment of screen operations, generating an image sequence for creating simple animations or analysis.

Notes

Please note that the capture area cannot exceed your actual screen resolution. Also, when capturing multiple frames consecutively, an excessively short delay may lead to inaccurate intervals due to system performance.

The Screencap mss node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…