Nodes/LF Nodes/Resize image to dimension
ComfyUI Node

Resize image to dimension

Resize to an exact size — crop or pad, your call

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
Resize image to dimension
  • image
  • ui_widget
  • image
  • image_list
  • count
height1216
width832
resize_methodbicubic
resize_modecrop
pad_color000000

Standard ComfyUI resize nodes mostly scale by a factor or fit into a box. LF_ResizeImageToDimension resizes to an exact width and height - and when the source aspect ratio doesn't match your target, it lets you decide whether to crop or pad. That decision is the whole value of this node, and it's the one beginners get wrong.

The two settings that matter:

  • resize_method - how the pixels are interpolated: bicubic (the default, and the right call for photos), bilinear/linear, or nearest/nearest exact for pixel-art and hard edges where you don't want smoothing to smear your crisp pixels.
  • resize_mode - crop or pad. Crop scales the image up so the target size is filled and slices off the overflow (you lose edges, but the output is exactly your dimensions and the whole frame is covered). Pad scales to fit and fills the leftover space with pad_color, a hex value like 000000 for black. Nothing gets cut, but you get bars.

You set width and height directly (defaults are 832×1216 - the SDXL portrait pair). Because it takes image as "an input image tensor or a list of image tensors," it's batch-friendly out of the box: give it a batch and you get image and image_list back, plus a count output so downstream nodes can know how many images they're dealing with.

Where this earns its keep: standardizing a mixed batch before training or captioning. If you're building a training dataset, your images need to come out at one consistent resolution - and the KB's LoRA-training advice is that preprocessing consistency matters more than anyone wants to admit. This node gives you exact control over how that consistency is achieved: crop when you want to preserve the subject's framing at full bleed, pad when you can't afford to lose any pixels (product shots, documents, anything with content near the edges).

The honest gotcha is the crop: the default crop-mode behavior can cut heads off portraits and punch the middle out of wide shots, because it crops the center unless your source happens to match the target ratio. If you're resizing faces or text-heavy images, pad is usually the safer first try. And a reminder that this is a pixel resize - the "make the image bigger but keep it sharp" conversation is a different node entirely (that's upscaling, and it's a whole separate rabbit hole).

Install is the LF standard: ComfyUI Manager → "LF Nodes", or

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf

then restart. No models, no heavy deps - this runs on CPU instantly. One pack-level note: comfyui-lf is frozen in legacy mode (still fully functional), with development continuing in lucafoscili/lf-nodes, where the same resize node lives.

Category✨ LF Nodes/Image

Inputs (7)

NameTypeDefaultDescription
imageIMAGEInput image tensor or a list of image tensors.
heightINT1216The target height for the output image.
widthINT832The target width for the output image.
resize_methodCOMBObicubicMethod to resize the image.
resize_modeCOMBOcropChoose whether to crop or pad when resizing.
pad_colorSTRING000000Color to use for padding if 'pad' mode is selected (hexadecimal).
ui_widgetoptKUL_TREE[object Object]

Outputs (3)

NameTypeDescription
imageIMAGE
image_listIMAGE
countINT