Nodes/ComfyUI Text Processor/Resize Image Advanced
ComfyUI Node

Resize Image Advanced

The resize node that does everything, including math you didn't know you wanted

By rookiestar28·Created 10 months ago·Updated 11 days ago· 16
Resize Image Advanced
  • image
  • mask
  • image
  • width
  • height
  • mask
resize_mode
width512
height512
aspect_ratio
proportional_width1
proportional_height1
fit
method
scale_to_side
scale_to_length1024
background_color#000000
crop_position
round_to_multiple0
device

ComfyUI's core Resize node is fine until it isn't. You want to letterbox into a fixed canvas, crop to a 16:9 target, force every output to a multiple of 64, or keep a mask aligned while you resize - and suddenly you're stacking three nodes and a bunch of math. Resize Image Advanced is the one-node answer, and it's more capable than the KJ-style resizer it's clearly modeled on.

If your workflow lives or dies by hitting exact pixel targets (latent sizes, video model constraints, upscale passes that must divide cleanly), this node quietly removes a whole category of fiddly failures.

How it works

Two resize_modes, and which one you pick changes the whole shape of the node:

  • explicit - you type width and height. The fit mode decides what happens when the source aspect doesn't match. Options run from fill/stretch/crop (distort or cut) through letterbox/pad (bars in your chosen background_color) to pillarbox_blur (the blurred-background look video editors love).
  • aspect_ratio - you pick a ratio (1:1, 3:2, 4:3, 16:9, 2:3, 3:4, 9:16, custom, or keep original) and a scale_to_side target: longest side, shortest side, width, height, or total kilo-pixels. This is the "give me a 1024-longest 16:9" workflow in one shot.

round_to_multiple then snaps the result up to a divisor - set 8 or 64 and every frame comes out divisible, which is the old KJ divisible_by behavior. method gives you the resampling pick (nearest, bilinear, area, bicubic, lanczos) plus nvidia_rtx_vsr, which only works if you have the NVIDIA VSR runtime and a compatible GPU - don't pick it hoping for magic on a plain setup. device lets you force cpu or gpu.

The mask part

The genuinely unusual feature: an optional MASK input that gets resized, cropped, or padded in lockstep with the image and comes back out the mask output aligned to the final frame. For mask-guided workflows where a letterbox or crop used to silently desync your mask from the image, this kills the problem at the source.

Inputs and outputs

The three you'll set most: resize_mode, fit, and round_to_multiple. background_color matters whenever you letterbox or pad - it's hex, #000000 default. crop_position decides which edge survives a crop.

Outputs are image, plus width and height (INT) - genuinely useful, since you can wire the actual dimensions into a latent-size node or conditioning and stop guessing - and mask.

Install

Part of ComfyUI Text Processor:

cd ComfyUI/custom_nodes
git clone https://github.com/rookiestar28/ComfyUI_Text_Processor.git
pip install -r requirements.txt

Or via ComfyUI Manager, searching "ComfyUI Text Processor". Restart after either. No extra downloads - nvidia_rtx_vsr is the only optional path, and it needs system-level NVIDIA software, not a pip package.

Gotchas

round_to_multiple rounds up, so a 512×512 source with round_to_multiple=64 stays 512 but a 510-wide target becomes 512 - expect the odd added pixel. And if background_color looks wrong, check you wrote #RRGGBB not a named color. Otherwise, this is the rare utility node that's harder to misuse than the core node it replaces.

CategoryComfyUI Text Processor/Image

Inputs (16)

NameTypeDefaultDescription
imageIMAGEImage batch to resize.
resize_modeCOMBOUse width and height directly or calculate a target from aspect-ratio controls.
widthINT5120–16384Explicit output width; zero preserves the source ratio from height.
heightINT5120–16384Explicit output height; zero preserves the source ratio from width.
aspect_ratioCOMBOTarget ratio for aspect_ratio mode; custom uses proportional values.
proportional_widthINT11–16384Width component used when aspect_ratio is custom.
proportional_heightINT11–16384Height component used when aspect_ratio is custom.
fitCOMBOHow source content is stretched, fitted, padded, cropped, or pixel-budgeted.
methodCOMBOResize algorithm; nvidia_rtx_vsr requires a compatible NVIDIA runtime.
scale_to_sideCOMBODimension or total-pixel policy controlled by scale_to_length in aspect_ratio mode.
scale_to_lengthINT10241–16384Target side length, or kilo-pixel budget for total_pixel mode.
background_colorSTRING#000000Hex fill color used by letterbox and padding fit modes.
crop_positionCOMBOAnchor used when crop fitting removes overflow.
round_to_multipleINT00–512Round final dimensions to this multiple; zero disables rounding.
deviceCOMBORequested processing device; availability depends on the selected method and runtime.
maskoptMASKOptional mask transformed with the same geometry as the image.

Outputs (4)

NameTypeDescription
imageIMAGEResized image batch.
widthINTFinal output width.
heightINTFinal output height.
maskMASKMask aligned to the resized image, or an empty mask when no mask is supplied.