ComfyUI Node

RC Image Crop

Cropping without leaving the graph

By kj863257·Created 11 months ago·Updated 10 months ago· 16
RC Image Crop
  • image
  • IMAGE
crop_methodmanual
x0
y0
width512
height512
aspect_width16.0
aspect_height9.0

Crop is the boring utility node you think you don't need until a workflow hands you a 1024×1024 image and the next step wants a 512×512 square, or you're generating tiles and need a centered 16:9 slice. RC_ImageCrop does exactly that inside the graph - no external editor, no re-load, just a crop that stays reproducible in your workflow. It's part of the RC Image Compositor pack (category RC/Utilities), and it's about as simple as a node gets while still having modes.

How it works

You pick a crop_method and the node slices the tensor with NumPy, clamping coordinates so you can't run off the edge. Three modes:

  • manual - exact coordinates. x/y are the top-left corner, width/height are the box. This is the mode for precision crops.
  • center - centered crop to width/height, ignoring x/y. If your target is bigger than the image, it clamps to the image size rather than erroring.
  • aspect_ratio - centered crop to a ratio, using aspect_width/aspect_height (default 16/9). It looks at which dimension is "too wide" and trims the other one to match. This is the one for thumbnails and video frames.

The inputs you'll actually set are crop_method plus the handful of numbers for whichever mode you chose. Everything else in the schema is the mode's spare parts.

Output is a single IMAGE at whatever size the crop produced. It processes batches frame-by-frame, so cropping a whole video sequence to the same region works without a loop node.

Installing it

Same as every node in this pack. ComfyUI Manager → search "RC Image Compositor" → install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/kj863257/ComfyUI_RC_Image_Compositor
cd ComfyUI_RC_Image_Compositor
pip install -r requirements.txt

Dependencies are just pillow, numpy, and opencv-python. Nothing to download.

Where people get burned

  • aspect_ratio ignores everything except the ratio. If you set aspect_width/aspect_height and leave width/height at 512, they're dead inputs in this mode. Confusion here is the #1 complaint, so read the mode's tooltip before touching the numbers.
  • Manual crop coordinates start at top-left, and 0,0 is top-left in ComfyUI. Sounds obvious, but if you're coming from a convention where y grows downward in another app, double-check before you batch.
  • Output size changes. Cropping is the rare node that changes dimensions mid-graph, and downstream nodes that assume a fixed size will complain or silently reshape. Crop as late as you can.
  • It doesn't resize. If you crop a 1024 image to 512 you get exactly 512 - no upscaling, no aspect preservation beyond what you asked for. Pair it with an image scale node if you need the output padded back up.

Honest take: this is the node you install for the workflow, not for joy. But the aspect_ratio mode is genuinely handy - it's the "fit to ratio, centered" behavior that most crop nodes make you do arithmetic for.

CategoryRC/Utilities

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
crop_methodCOMBOmanualCrop method: - manual: Manual coordinates - center: Center crop to size - aspect_ratio: Crop by ratio (centered)
xINT00–8192Crop start X coordinate (manual mode)
yINT00–8192Crop start Y coordinate (manual mode)
widthINT5121–8192Crop width
heightINT5121–8192Crop height
aspect_widthFLOAT16.00.1–100Width part of aspect ratio (ratio mode)
aspect_heightFLOAT9.00.1–100Height part of aspect ratio (ratio mode)

Outputs (1)

NameTypeDescription
IMAGEIMAGE