ComfyUI Node

Crop & Resize

One node to get every image to the same aspect and size — boring, and that's the point

By creativeself-kim·Created 10 months ago·Updated 6 months ago· 1
Crop & Resize
  • image
  • image
aspect_ratio1:1
long_side1024

Batch pipelines have an unglamorous requirement: every input has to match. Different source videos or screenshots at different resolutions will quietly wreck a ControlNet batch or produce latent-size mismatches downstream. ImageCropResize is the janitor node - it center-crops anything to a target aspect ratio and resizes so the long side is exactly what you asked for. It won't win you any awards, but it will stop a dozen "why is this batch 3 frames and the other one 5?" debugging sessions.

How it works

For each image in your batch it computes the target ratio (e.g. 16:9), then center-crops to the largest rectangle at that ratio that fits inside the source - full width if the target is wider, full height if it's taller. Then it resizes so the long side equals your long_side value, rounding the short side down to a multiple of 8. That multiple-of-8 bit is the detail that matters: latent-space models want dimensions divisible by 8 (and often 16 or 64 for video models), so the node spares you the "divisible by 8" mental math. Resizing uses LANCZOS, the high-quality choice.

Center-crop is a blunt instrument, which is fine here. If the subject isn't centered, the crop may take off a head - if that matters, frame your sources centered before it hits this node.

The inputs

  • image (IMAGE) - one image or a batch.
  • aspect_ratio - 21:9 / 1.85:1 / 16:9 / 9:16 / 1:1. Note 1.85:1 is the classic widescreen cinema ratio, a nice touch for storyboard work.
  • long_side (INT, default 1024, 64–4096, step 8) - the pixel length of the longer dimension.

Output is a single image (IMAGE), all frames at the same aspect and size. Batch in, batch out.

Why you'd actually use it

It sits perfectly in front of a ControlNet preprocessor like this pack's own CNPreprocessor - you normalize every reference frame to the same dimensions, then the preprocessor sees consistent input. It's also handy right after a latent decode if you want a uniform frame size before a video-pass or a save. The aspect presets align with the same set used by this pack's UtilEmptyLatent, so you can size a reference image and an empty latent to the same ratio without converting between them in your head.

Install

Ships in the IXIWORKS pack: ComfyUI Manager → search ComfyUI-VideoDescription → Install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/IXIWORKS-KIMJUNGHO/ComfyUI-VideoDescription

No extra dependencies - torch, numpy, and PIL are all ComfyUI staples. It's a utility node, not a flashy one, and that's fine: half of a reliable workflow is having the boring nodes that make everything else line up.

CategoryIXIWORKS/Image

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
aspect_ratioCOMBO1:15 options: 21:9, 1.85:1, 16:9, 9:16, 1:1
long_sideINT102464–4096

Outputs (1)

NameTypeDescription
imageIMAGE