ComfyUI Node

Crop Image by Coords

Crop by coordinates, the manual way to give a tiny region a huge render budget

By einhorn13·Created about a year ago·Updated about a year ago· 1
Crop Image by Coords
  • images
  • coords
  • IMAGE
width64
height64
x_coords_str
y_coords_str

Crop Image by Coords (class CropByCoords) lets you grab a width×height rectangle out of an image at an exact (x, y) position, driven by numbers instead of a click-drag box. On its own that's a mild convenience. Where it earns its keep is the crop-and-stitch inpainting trick: crop a small region - an eye, a hand, a logo - render that region at the model's native resolution with a full generation budget, then paste it back with PasteByCoords. A 64px eye gets 1024px of diffusion to work with. That's the "only-masked detail at full resolution" move from the inpainting playbook, and this node is the crop half of it.

How it works. Simple, honest slicing. You give images, a width and a height, and a set of coordinates. The node cuts a rectangle at each (x, y) and returns a batch of crops, all forced to exactly width×height. If a crop would run off the edge, the missing area is filled with black zeros rather than erroring out - which means out-of-bounds crops come back with black bars, not crashes. Coordinates are fed in either as the pack's COORDS type (from CombineCoords) or as plain comma-separated strings via x_coords_str and y_coords_str.

Two behaviors to know, both straight from the source. If you pass no coordinates at all, the node returns the image untouched - a deliberate no-op so a half-configured graph doesn't blow up. And if your coordinate list is shorter than the batch, the last coordinate is reused for the remaining images. So one coordinate crops every image in the batch the same way, which is the common case.

The inputs that matter. images, width, height are required (width/height default to 64, min 1 - set them to your target crop size). Optional: coords, or x_coords_str + y_coords_str if you're typing numbers in. Output is the cropped IMAGE batch.

Install. Nothing special about this one - the whole pack is zero-dependency torch code, no models to fetch:

cd ComfyUI/custom_nodes
git clone https://github.com/einhorn13/ComfyUI-ImageProcessUtilities

Restart ComfyUI. If you prefer Manager, search "ImageProcessUtilities"; it isn't on the official Comfy Registry as of writing, so the clone is the dependable path.

Common issues. The black-bar surprise is the big one: crop to x=10 on an image where the region extends past the right edge, and you get a black filler strip. If your cropped tile looks wrong, check whether the rectangle fits inside the image first. Also, the no-op-on-missing-coords behavior can look like the node is broken when you've wired it up wrong - it's not, it's just waiting for coordinates.

Categoryimage/transform

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
widthINT64
heightINT64
coordsoptCOORDS
x_coords_stroptSTRING
y_coords_stroptSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE