Image Aspect Ratio Crop
Crop to the aspect ratio your model actually trained on
- image
- IMAGE
- chosen_resolution
Every modern model is trained on a short list of aspect-ratio buckets, and they're happiest when you feed them one of those. Krea 2, Ideogram 4, SDXL, Flux - same story. Give a Krea 2 edit node a random 3:2 landscape reference and it works, but it squints. ImageAspectRatioCrop is the Rebalance Pack's answer: crop any image to the closest ratio from a list you control, and get told exactly which one it picked.
It's the kind of node that looks boring until you've stared at a reference-image pipeline producing inconsistent compositions. Then it's the difference between "why is the framing wrong" and "oh, every input is landing on the same bucket."
How it works
You give it a multiline list of WxH resolutions - the default is a sensible bucket set (1000x1000, 768x1344, 1344x768, 832x1216, 1216x832 - the Krea/SDXL-family shapes). It computes your image's aspect ratio, finds the entry with the closest ratio, then crops either the width or the height so the remaining rectangle matches that ratio exactly. Nothing is resized in the default mode; this is a pure crop, so you lose pixels from the sides or top/bottom, never both.
The crop_position dropdown (center/top/bottom/left/right) decides which side gets sacrificed - "top" keeps the top of the image, which matters when you're cropping faces out of portraits or don't want to chop a horizon. And if you flip resize_to_target on, it follows the crop with a lanczos resize to the exact target dimensions, so your output lands on the precise bucket rather than just the ratio.
The inputs and outputs that matter
- image - whatever you're feeding the model.
- aspect_ratios - the multiline list. Add your own buckets; this is where you teach it your model's actual native resolutions.
- crop_position - center is fine for most things; reach for top/bottom when content sits at one edge.
- resize_to_target - on if you need exact pixels, off if a ratio-perfect crop is enough.
The two outputs are the real story. IMAGE is the cropped tensor, and chosen_resolution is a STRING in WxH form reporting which bucket it landed on. Wire that string into a ResolutionSelector-style empty latent, or just into a display node to sanity-check your choices - knowing what the crop actually chose beats guessing.
Install
It's part of the Rebalance Pack, so it arrives with everything else. ComfyUI Manager: search "ComfyUI-Conditioning-Rebalance" (or "Rebalance Pack") and install. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/nova452/ComfyUI-ConditioningKrea2Rebalance
Restart after cloning. No models, no dependencies beyond what ComfyUI ships.
Where it fits
Think of it as the front door of a Krea 2 / Ideogram 4 edit workflow: crop every reference to a bucket, then encode. And it pairs naturally with the pack's ImageResolutionCap on the other side - cap the resolution so huge images don't OOM your encoder, crop so the aspect ratio is clean. The one thing it won't do is pad; if you'd rather keep the whole image and letterbox it, that's the pad mode on LoadImagesBlaze instead. Cropping loses content, so for refs where the full frame matters, pad. For everything else, crop - models read a clean ratio far better than they read bars.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| aspect_ratios | STRING | 1000x1000 768x1344 1344x768 832x1216 1216x832 | — |
| crop_position | COMBO | center | 5 options: center, top, bottom, left, right |
| resize_to_target | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| chosen_resolution | STRING | — |