Image Crop By Percentage
'cut 10% off each edge'
- image
- Cropped Image
- x
- y
Image Crop By Percentage is the boring, dependable crop node - and "boring" is a compliment. You tell it how much to remove from the top, bottom, left, and right, and it crops. No mask, no detection, no surprises. Sometimes that's exactly the node you want, because the whole point is that you control the crop, not an algorithm.
The percentage semantics are the one thing to internalize, because they're the pack's own convention and they're slightly non-obvious. Each side's value is measured over its own half-axis. So left = 100 means "crop from the left edge all the way to the center" - that's half the width, not the whole width. To keep only the middle 50% of the frame, set all four sides to 50. To trim a tidy 10% off the visual edges, set every side to 10. The README spells it out: "100 reaches the center from that side."
The inputs
- image - anything ComfyUI calls an image, batch included; it processes every frame.
- use_pixel (off by default) - switches from percentages to exact pixel values, and lifts the 0–100 clamp so you can crop more than the half-axis in one go.
- top / bottom / left / right - the four crop amounts. In percentage mode they're clamped to 0–100; in pixel mode they can go as high as 9999.
Outputs are the Cropped Image, plus x and y - the pixel coordinates of the crop's top-left corner. That second part is quietly useful: if you're cropping then pasting the result back onto a composite, x and y are exactly the offset you need, already as integers. No reconstructing the crop position by hand.
When to reach for it
- Trimming fixed borders off a scanned or captured asset.
- Pre-cropping before a resize so you hit a target aspect ratio from the content side rather than stretching.
- Batch normalization where every image gets the same edge trim, regardless of its size - percentages scale with the image, which is the whole advantage over pixel crops.
Where it's not the tool: subject-aware cropping. This node knows nothing about your content - it's a geometric crop. If you want to crop to the person in the frame, the same pack's MaskCropByPercentage finds the subject from a mask instead. And there's no "smart" centering or aspect-ratio lock here; you're the smart part.
One honest limitation: the output can't go smaller than 1 pixel, and the code guards against zero-area crops by clamping - so extreme values won't crash, they'll just land near the edge. In percentage mode the values are clamped to 0–100, and if you set something out of range it tells you in the console. That's the whole troubleshooting story.
Install
As with every node in this pack: ComfyUI Manager (search "ComfyUI-Image-Resizing") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Zar4X/ComfyUI-Image-Resizing
Restart, and it's under Image Resizing/Crop Image. No models, no downloads, standard dependencies only.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| use_pixel | BOOLEAN | false | — |
| top | INT | 0-9999–9999 | — |
| bottom | INT | 0-9999–9999 | — |
| left | INT | 0-9999–9999 | — |
| right | INT | 0-9999–9999 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Cropped Image | IMAGE | — |
| x | INT | — |
| y | INT | — |