Nodes/CRT-Nodes/Percentage Crop Calculator (CRT)
ComfyUI Node

Percentage Crop Calculator (CRT)

Crop by percentage, not by pixel math

By PGCRT·Created 2 years ago·Updated a day ago· 132
Percentage Crop Calculator (CRT)
  • image
  • image
  • width
  • height
crop_percent_width10.0
crop_percent_height10.0
locationcenter

Cropping in ComfyUI is usually a pixel-coordinate guessing game: "the subject is at x=412, so I need a box that's 640 wide…" Percentage Crop Calculator gets rid of the arithmetic. You tell it how much to cut off each side - as a percentage of the image - and where to anchor the remaining crop, and it does the slicing.

The reason percentages are nicer here is that they survive resolution changes. A 10% crop on a 1024-wide image is 102 pixels; on a 2048-wide one it's 204. Same feel, different numbers. If you build a workflow around pixel offsets, swapping in a different source resolution silently breaks the framing. Do it by percentage and the crop keeps working whether your input is 512 or 4K.

What you set

Three inputs, and only two of them really matter:

  • crop_percent_width (default 10) - percent removed from the width before cropping. So 10 removes 10% of the total width, split across both sides unless you anchor to an edge.
  • crop_percent_height (default 10) - same idea for height.
  • location (default center) - where the remaining crop sits within the original: center, top, bottom, left, right, or any of the four corners.

The mental model: you're carving a smaller rectangle out of the bigger image. Percent tells you how much smaller; location tells you where to anchor the carving knife. A center crop trims evenly from all four edges, while top-left keeps everything anchored to the upper-left and trims only the right and bottom.

Outputs are image (the cropped result), plus width and height as INTs - handy if you need to feed the new dimensions downstream (into a conditioning node or a latent setup) without recomputing them.

Install

It's part of CRT-Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/PGCRT/CRT-Nodes.git
pip install -r CRT-Nodes/requirements.txt

Restart ComfyUI, or install the pack from ComfyUI Manager by searching CRT-Nodes. Look for it under CRT/Image.

Troubleshooting

The subtle gotcha is that 0% doesn't mean "no crop" in the way you'd hope - it means the crop box is the full image, which is fine, but the output dimensions still get computed and returned, so if something downstream chokes on a "cropped" image that's identical to the input, that's expected behavior, not a bug.

Also note the crop is a straight rectangle slice - there's no masking or soft edge here. If you want a feathered crop or a face-tracking crop that follows a subject across video frames, this isn't the node; look at the pack's SAM-based Isolate Input family for that. Percentage Crop is the fast, predictable, "just trim the edges" tool, and for that it's genuinely better than hand-typing coordinates.

CategoryCRT/Image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
crop_percent_widthFLOAT10.00–100
crop_percent_heightFLOAT10.00–100
locationCOMBOcenter9 options: center, top, bottom, left, right, top-left, +3

Outputs (3)

NameTypeDescription
imageIMAGE
widthINT
heightINT