Nodes/ComfyCollectorNodes/Cropped Image (CCN)
ComfyUI Node

Cropped Image (CCN)

Stop guessing crop coordinates, drag them on a canvas

By valkymaera·Created 4 months ago·Updated 10 days ago· 1
Cropped Image (CCN)
  • image
  • image
  • raw_image
  • mask
  • crop_x
  • crop_y
  • crop_width
  • crop_height
  • source_image
lock_ratiofalse
snap_to8
crop_x10.0000
crop_y10.0000
crop_x21.0000
crop_y21.0000
loaded_image
debugfalse

Crop boxes are the fiddliest part of a workflow to set by hand - you type four pixel coordinates, run, look at the result, adjust, run again. Cropped Image (CCN) replaces that loop with a canvas: the image is drawn right inside the node with a dimmed overlay outside the crop region, and you drag the corner handles to define exactly what you want. It's the difference between programming a crop and drawing one.

How it works

The node shows your source image on a canvas. Drag the four corners to resize (the opposite corner stays pinned), drag inside the rectangle to move it, and a live readout shows the crop's pixel size and aspect ratio. lock_ratio keeps the aspect fixed while you drag and re-applies it if a differently-sized image loads. The crop rectangle is stored as normalized 0–1 coordinates, so it serializes with the workflow - reload it later and the crop is still there.

The outputs are the useful part, because you rarely want just one thing:

  • image - the model-friendly crop: resized so width and height are multiples of snap_to (default 8). This is the one that feeds your sampler or inpaint region.
  • raw_image - the exact pixel crop, no resampling. For pixel-fidelity work.
  • mask - a full-source-size mask, 1.0 inside the crop and 0.0 outside. Wire it to a ControlNet or mask input.
  • crop_x, crop_y, crop_width, crop_height - the crop geometry as ints.
  • source_image - the original uncropped image, passed through.

It doubles as a standalone image loader: with nothing wired to image, the loaded_image picker loads a file from your input directory. And wired inputs take priority - the README's key rule is that a wired image overrides any loaded file.

Install

ComfyUI Manager → search ComfyCollectorNodes → Install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/valkymaera/ComfyCollectorNodes

Restart, no pip step. Under the (CCN) suffix.

Gotchas worth knowing

Two things from the README that save you a scare. First, cropped images are stored in ComfyUI's temp folder, which is cleared on restart - the node output isn't persisted as a file, so don't go hunting for the crop on disk later. Second, when you wire an image in, the node can show a "Load Preview" button to pull a preview from upstream without executing; if that upstream is a video scrubber, the preview pixel size may read smaller than the real output - an info bug only, the actual output is correct. If you're chaining Cropped Image with the pack's Video Scrubber to grab a frame and crop the exact subject for a re-inpaint, that's the flagship use case, and it works well. The one habit to build: check snap_to before you queue - a crop that isn't a multiple of 8 can produce odd-dimension latents downstream.

CategoryComfyCollectorNodes/Image

Inputs (9)

NameTypeDefaultDescription
lock_ratioBOOLEANfalse
snap_toINT81–64Model-friendly output dimensions are floored to this multiple.
crop_x1FLOAT0.00000–1
crop_y1FLOAT0.00000–1
crop_x2FLOAT1.00000–1
crop_y2FLOAT1.00000–1
imageoptIMAGE
loaded_imageoptCOMBO2 options: none, example.png
debugoptBOOLEANfalse

Outputs (8)

NameTypeDescription
imageIMAGE
raw_imageIMAGE
maskMASK
crop_xINT
crop_yINT
crop_widthINT
crop_heightINT
source_imageIMAGE