Nodes/ComfyUI-YCNodes_Toolkit/YC Image Crop Interactive
ComfyUI Node

YC Image Crop Interactive

It stops, you drag, you confirm

By yichengup·Created 10 months ago·Updated 4 months ago· 59
YC Image Crop Interactive
  • image
  • image
  • mask
  • c_param
  • out
modeAuto

Most crop nodes are "load a picture, then crop it." YC Image Crop Interactive flips that: you feed it any IMAGE from your graph, hit queue, and the node stops, pops a crop overlay on its face, and waits for you. Drag the box - expanding past the image edges is allowed, same as the pack's Load Image Crop Expand - then confirm. Out comes the cropped image, a mask marking the expansion area, a c_param DICT, and a boolean.

The DICT is the handoff: wire c_param into YC Image Crop Batch Apply and the exact framing you just drew gets replicated across a whole batch. That pairing is the reason this node exists.

How it works

This is genuinely interactive, not a modal gimmick. On run the node registers itself in a server-side store, pushes the image to the frontend over a sync message, and blocks on an event - with a 600-second timeout and a 30-second heartbeat from the browser to keep it alive. When you confirm, a POST to /yc_image_crop_interactive/confirm does the actual crop math and wakes the blocked node. Cancel returns the original image plus an all-black mask rather than erroring out. Crop params persist per node id, which is what the modes build on.

The mode input is the one to understand:

  • Auto - asks you the first time, or any time the source dimensions change; reuses saved params otherwise. The sensible default.
  • Always Interactive - asks every single run. Great for active editing, annoying for batch runs.
  • Always Reuse - skips the dialog if a saved crop exists, and scales it proportionally if the image size changed.

Outputs: image, mask, c_param (DICT), out (BOOLEAN).

The gotchas

It blocks the queue while the dialog is up - the run is physically waiting on you, so don't queue a big batch and walk away expecting it to finish. If the dialog times out (10 minutes) or the heartbeat dies, it cancels and returns the original image. And in API/headless mode, Always Reuse is basically the only setting that makes sense - there's no browser to ask. Expect the same double-click-to-stop-dragging quirk as the rest of the family.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes_Toolkit

Restart, or use ComfyUI Manager and search "ComfyUI-YCNodes_Toolkit". Dependencies are numpy and Pillow only - no models. It's the most opinionated node in the pack because it owns your attention mid-queue, but that's precisely what an interactive crop is supposed to do.

CategoryYCNode/utils

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
modeCOMBOAuto3 options: Auto, Always Interactive, Always Reuse

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
c_paramDICT
outBOOLEAN