Crop Image Sides
Trim pixels off any side — the no-frills crop you'll actually use
- images
- IMAGE
Sometimes you don't need mask detection, bounding boxes, or smart anything. You need to chop 64 pixels off the left edge and move on. Crop Image Sides is exactly that: four integer inputs - left, right, top, bottom - and it removes that many pixels from each side. It's the boring node in the pack's crop-uncrop pipeline, and boring is the compliment here.
How it works
The node loops over every image in your batch and slices the tensor directly: left strips columns off the front, right off the back, top rows off the top, bottom off the bottom. Straight tensor slicing, no resizing, no reinterpretation - the remaining pixels are pixel-identical to the source. If your crop values would consume the whole image (or more), it logs a warning and returns that image unchanged rather than crashing or returning a zero-size tensor. That graceful fallback is a nice touch.
The inputs are all in pixels, each 0–4096, so it composes naturally: a 1024×1024 image with left: 100, right: 100, top: 100, bottom: 100 becomes an 824×824 image.
Where it fits
Standalone, it's the fastest way to trim letterbox bars, watermark edges, or a messy border before you hand an image to an upscaler or sampler. In the pack's bigger story, it's the manual cousin of Crop From Mask (BatchCropFromMaskSimple): that node auto-detects a subject region and gives you coordinates; this one is for when you already know the region because you're looking at it.
One thing to know if you're building the full pipeline: CropImage gives you only the cropped IMAGE out. It does not return the bounding box, so if you want to paste the result back into the original with Uncrop Image, you should start from the mask-based crop instead - that one hands you the bboxes you need.
Installing it
Part of Pirog's Nodes, so one install covers the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Pirog17000/Pirogs-Nodes
pip install -r Pirogs-Nodes/requirements.txt
Or search "Pirog's Nodes" in ComfyUI Manager and restart. Zero extra dependencies - this is pure torch slicing.
Gotchas
The main trap is misreading the semantics: right strips from the right edge, bottom from the bottom - they're not "keep this many pixels." Easy to get backwards on your first go, so preview before you commit. And because the fallback silently returns the original image when the crop is too aggressive, an oversized value won't error - it'll just quietly not crop, which has confused at least one person before you.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| left | INT | 00–4096 | — |
| right | INT | 00–4096 | — |
| top | INT | 00–4096 | — |
| bottom | INT | 00–4096 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |