ImagesCropByRatioAndResizeBatch
ImagesCropByRatioAndResizeBatch — crop-and-resize a whole batch in one shot
- image
- IMAGE
- width
- height
ImagesCropByRatioAndResizeBatch is the batch version of ImageCropByRatioAndResize. Same crop-to-ratio-then-resize-to-pixels logic, same parameters - but it accepts a list of images and processes every one of them, returning a single concatenated IMAGE batch plus the target width and height. If you're normalizing a folder of frames for a video workflow or a dataset of reference images, this saves you the "loop node + crop node" rigmarole in one node.
How it works. The class is literally a subclass of ImageCropByRatioAndResize with INPUT_IS_LIST = True, which tells ComfyUI to hand it lists rather than single values. It takes each image in the list, runs the parent's crop-and-resize execute() on it with your settings, collects the results, and concatenates them into one tensor batch along the batch dimension. If only one image comes in, it just returns that single cropped result - no pointless wrapping. The width/height outputs are your target size (the width_ratio_size/height_ratio_size values), shared across every image.
Inputs and outputs. image (IMAGE, list-input), width_ratio_size (INT, default 512), height_ratio_size (INT, default 512), position (enum: center/top/right/bottom/left), interpolation (enum: nearest/bilinear/bicubic/area/nearest-exact/lanczos). Outputs: IMAGE (concatenated batch), width (INT), height (INT).
The caveats worth knowing. Because it inherits the parent's math, the same trap applies: width_ratio_size and height_ratio_size are both the aspect ratio and the exact output size, so set them to real pixel targets, not ratio numbers (use 1280x720 for 16:9, not 16x9). Every image in the batch gets the identical treatment - same position, same interpolation - so if your inputs are wildly different aspect ratios, some will be cropped much harder than others. And like anything batch in ComfyUI, memory scales with the total number of pixels; a big list of high-res images can eat a surprising amount of RAM. Keep batches modest, or downscale first.
When you'd use it. Standardizing video frames before a model pass, prepping a set of reference images for img2vid, or tidying a dataset to one resolution and aspect. If you're only ever processing a single image, the non-batch ImageCropByRatioAndResize is the simpler choice.
Install. Same pack as the rest:
ComfyUI Manager → search "komojini-comfyui-nodes" → Install → restart
or cd ComfyUI/custom_nodes && git clone https://github.com/komojini/komojini-comfyui-nodes. No models, no heavy deps. It's one of the few genuinely standalone utilities in the pack, so if the video stuff isn't for you, this (and its single-image sibling) is still a legitimate reason to install.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width_ratio_size | INT | 5121–8192 | — |
| height_ratio_size | INT | 5121–8192 | — |
| position | COMBO | 5 options: center, top, right, bottom, left | |
| interpolation | COMBO | 6 options: nearest, bilinear, bicubic, area, nearest-exact, lanczos |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| width | INT | — |
| height | INT | — |