Nodes/ComfyUI illumorae/Image Resize w Matte
ComfyUI Node

Image Resize w Matte

Resize that respects your pipeline's math

By CorvaeOboro·Created 8 months ago·Updated 6 days ago· 1
Image Resize w Matte
  • image
  • get_image_size
  • IMAGE
  • width
  • height
width512
height512
upscale_methodlanczos
keep_proportionfalse
divisible_by2
apply_mattefalse
matte_width512
matte_height512
width_input
height_input
crop

ComfyUI is full of resize nodes. What makes Image Resize w Matte worth a look is that it bakes in three pipeline constraints most resizers make you handle by hand: aspect preservation, a divisibility requirement (so your dimensions land on a multiple of 8/16/64 that the model and VAE actually accept), and an optional matte canvas - resize onto a fixed canvas with padding, the letterbox approach, instead of cropping. If you've ever fought a VAE error because your height was 1026 instead of 1024, you know exactly why the divisibility knob exists.

It also does one quietly useful thing: it outputs the final width and height as ints, so downstream nodes (filename templates, other resizers, video conditioning) can read what actually happened instead of assuming.

How it works

The pipeline is straightforward: take the image, optionally preserve its aspect ratio (keep_proportion), force the result to a multiple of divisible_by (default 2; set 8 or 16 for most model constraints), resize with your choice of upscale_method (nearest-exact, bilinear, area, bicubic, lanczos), then optionally place the resized image onto a matte_width × matte_height canvas (that's the letterbox).

The inputs that matter:

  • width / height - target dimensions (0–4096, stepped by 8). Note keep_proportion is off by default - if you leave it off, the image is forced to the exact target and distorts. Flip it on to preserve ratio, and the result may not match the requested numbers exactly.
  • divisible_by - rounds dimensions to a multiple. This is your VAE-constraint dial.
  • apply_matte + matte_width / matte_height - compositing onto a larger canvas with the image fitted (padded), for letterboxing or matching a fixed output canvas.

The optional inputs are where it gets interesting: width_input and height_input let you feed dimensions in as wires instead of typing them (e.g., the output of the pack's WAN adaptive framing node), and get_image_size accepts an IMAGE whose dimensions become the target - so you can resize to match another image without knowing its size. crop (disabled/center) adds a center-crop option for the matte stage.

Outputs: IMAGE, width (INT), height (INT).

Installing it

Part of CorvaeOboro's ComfyUI_illumorae (CC0, pure code). ComfyUI Manager → search illumorae, or:

cd ComfyUI/custom_nodes
git clone https://github.com/CorvaeOboro/ComfyUI_illumorae

Common issues

  • Image squished - keep_proportion is off by default; that's the default trap. Turn it on unless distortion is the plan.
  • VAE/module resolution errors downstream - raise divisible_by to 8 or 16 (or 64 for some video pipelines) so the final size is actually acceptable to the model. Setting it to 0 disables the constraint.
  • Matte does nothing - apply_matte defaults to false. You must flip it on for the matte canvas to take effect.
  • Width/height outputs don't match what you typed - correct behavior when keep_proportion or divisible_by adjusted them; read the outputs instead of trusting your inputs.
Categoryillumorae

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
widthINT5120–4096
heightINT5120–4096
upscale_methodCOMBOlanczos5 options: nearest-exact, bilinear, area, bicubic, lanczos
keep_proportionBOOLEANfalse
divisible_byINT20–512
apply_matteBOOLEANfalse
matte_widthINT5120–4096
matte_heightINT5120–4096
width_inputoptINT
height_inputoptINT
get_image_sizeoptIMAGE
cropoptCOMBO2 options: disabled, center

Outputs (3)

NameTypeDescription
IMAGEIMAGE
widthINT
heightINT