Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Crop Image
ComfyUI Node

๐ŸฆŠ RS Crop Image

Crop by drawing on the image, and never fight a VAE size-multiple error again

By RaykosanยทCreated about a year agoยทUpdated 5 days agoยท 79
๐ŸฆŠ RS Crop Image
  • image
  • mask
  • CROPPED_IMAGE
  • CROP_DATA
โ—„multiple_modefalseโ–บ
โ—„multiple_of8โ–บ
โ—„crop_data{}โ–บ

The stock crop nodes in ComfyUI make you type coordinates, which is exactly the wrong way to find a face. ๐ŸฆŠ RS Crop Image (RSCropImage) shows you the actual image, lets you draw the rectangle with your mouse, and then - the part that matters - can snap that rectangle to a size multiple of 4, 8, 16, 32, or 64. That snap is the whole game: SD 1.5 and SDXL want multiples of 8, Flux wants 16 or 64, and a crop that ignores this gets rejected or silently mangled by the VAE. This node guarantees the cropped output is VAE-clean before you ever touch a sampler.

How it works

Wire an image in, run the queue, and the workflow pauses with the image shown inside the node. You drag the rectangle or its corner handles, the node reports the live dimensions, and when you hit โœ”๏ธ ACCEPT it continues. Two details make it more than a pretty crop:

  • Multiple mode. With multiple_mode on, the crop box snaps so the final size is a multiple of whatever you set in multiple_of. There's also a mask path: connect a MASK and it auto-detects the crop region from the bounding box of all non-zero pixels (using a 0.5 threshold), then aligns that box to your chosen multiple.
  • CROP_DATA. The node outputs a string of precise crop coordinates alongside the CROPPED_IMAGE. Save that, run the same crop through a dozen models or seeds, and you get bit-identical regions every time.

Inputs that matter

  • image - what you're cropping.
  • multiple_mode - toggle the size snapping on.
  • multiple_of - 4, 8, 16, 32, or 64. Pick 8 for SD-family, 16/64 for Flux.
  • mask (optional) - auto-crop to the mask's bounding box.
  • crop_data (optional) - feed a saved crop string back in to reproduce a region exactly.

Outputs: CROPPED_IMAGE and CROP_DATA (the string that RS Insert Crop - RSInsertCropImage - consumes to paste the edited fragment back, pixel-perfect).

How to install

Part of ComfyUI_RaykoStudio:

cd ComfyUI/custom_nodes
git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git

Restart ComfyUI, or use ComfyUI Manager and search "ComfyUI_RaykoStudio". No model downloads; it's all local image math.

Common issues

  • It pauses forever. That's by design - the queue waits until you hit โœ”๏ธ ACCEPT, โŒ CANCEL, or close the workflow. Don't panic; click ACCEPT.
  • Cropped output rejected by your model. You turned off multiple_mode. If you're cropping for a Flux pipeline, enable it and set multiple_of to 16 or 64.

The author demoed this node on r/comfyui and the "why do I need this" answer is the multiple-snapping plus the reverse-paste story: crop โ†’ inpaint or upscale the fragment โ†’ stitch it back with the matching Insert node. That's the crop-and-stitch pattern the inpainting community converged on, and this pair implements it with a much nicer UI than raw coordinates.

Category๐ŸฆŠ RaykoStudio

Inputs (5)

NameTypeDefaultDescription
imageIMAGEโ€”
multiple_modeBOOLEANfalseโ€”
multiple_ofCOMBO85 options: 4, 8, 16, 32, 64
maskoptMASKโ€”
crop_dataoptSTRING{}โ€”

Outputs (2)

NameTypeDescription
CROPPED_IMAGEIMAGEโ€”
CROP_DATASTRINGโ€”