Nodes/WAS Node Suite v3/Image Crop Region
ComfyUI Node Runs on cloud

Image Crop Region

Crop by the numbers — no dragging, no guessing

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Image Crop Region
  • image
  • IMAGE
width512
height512
x0
y0

Most crops in ComfyUI happen through a mask or a bounding box, because a mask is an image and it flows through the graph like one. But sometimes you just want to take a rectangle out of a picture - 512 wide, 512 tall, starting 256 pixels in from the top-left - and you want it done by numbers, deterministically, on every frame of a batch. That's exactly what Image Crop Region is: four integers in, one crop out. No mask to paint, no detector to argue with.

It's part of WAS Node Suite (WASasquatch's MIT pack, v3 ships 457 nodes), filed under WAS Suite/Image/Process.

The inputs

  • image - the picture to cut. A batch is cropped to the same rectangle frame by frame and comes back the same length.
  • width and height - how big the rectangle is, in pixels. 512×512 is a square crop; 1×1 is a single pixel; anything goes between.
  • x and y - the rectangle's top-left corner, measured in pixels from the frame's left and top edges. 0,0 starts at the corner; 256 skips the first 256 rows or columns.

The honest math that surprises people: a rectangle that reaches past the right or bottom edge just stops there. Ask for a 512-wide crop at x=400 on a 640-wide image and you get 240 pixels, not an error and not a wrap-around. x and y past the edge get pulled back onto it. So the output is "at most width × height, smaller where it ran off an edge" - and the node tells you so.

The built-in eyeball check

Rather than trusting the numbers, the node draws its own band: the frame that went in and the frame that came out at one common scale, with both sizes and the pixel counts written beside them. A rectangle that ran off the edge shows up as a smaller answer right there on the node - the sort of feedback that otherwise waits to ambush you at the sampler when a mystery-sized tensor comes back.

Where it earns its keep

This is a node for people building reproducible pipelines, not one you'll use freehanding a look. The use cases are all "I know exactly which region":

  • Cutting a regular grid of tiles out of a big image for an upscale pass, with the coordinates driven by a math or loop chain.
  • Standardizing a crop across a whole batch or a whole folder - same rectangle on every frame.
  • Isolating a UI element or a watermark region you can locate by arithmetic rather than vision.
  • Feeding one precise region to an inpaint or re-render without generating a mask for it first.

Because the inputs accept wires, the rectangle can be computed - crop the top third of every frame in an animation, track a region across a sequence using a formula, chop a contact sheet into cells with a loop. That's where it beats a drag-to-crop: it runs the same every time, on a hundred images, unattended.

Install and notes

WAS Node Suite installs the standard way: ComfyUI Manager, search "WAS Node Suite v3", or git clone https://github.com/WASasquatch/was-node-suite-comfyui into ComfyUI/custom_nodes and restart. Needs ComfyUI 0.14.0+ and Python 3.10+. v3 installs no Python packages and downloads nothing - no OpenCV, no scikit-image, none of the old v2 dependency fights.

The one habit to build: think in "rectangle from top-left," not center. There's no "center the crop on x,y" option, so if you're cropping around a point, subtract half the width and height yourself before feeding x and y. And remember the edge-clamping behavior - if your loop ever steps a rectangle past the frame edge, the answer silently shrinks instead of failing. When that matters, check the drawn band, not just the output.

CategoryWAS Suite/Image/Process

Inputs (5)

NameTypeDefaultDescription
imageIMAGEThe picture to crop. A batch is cut to the same rectangle frame by frame and comes back the same length.
widthINT5121–16384Pixels the rectangle spans across; INT. 512 is a square crop's side, 1 is a single column. A rectangle reaching past the right edge stops there, so the answer comes back narrower than this.
heightINT5121–16384Pixels the rectangle spans down; INT. 512 is a square crop's side, 1 is a single row. A rectangle reaching past the bottom edge stops there, so the answer comes back shorter than this.
xINT00–16384Pixels from the left of the frame to the rectangle's left edge; INT. 0 starts at the edge, 256 skips the first 256 columns. A value past the last column is pulled back onto it.
yINT00–16384Pixels from the top of the frame to the rectangle's top edge; INT. 0 starts at the edge, 256 skips the first 256 rows. A value past the last row is pulled back onto it.

Outputs (1)

NameTypeDescription
IMAGEIMAGEThe rectangle that was cut out, at most width by height and smaller where it ran off an edge. Same batch length and channel count as the picture that went in.