Image Resize w Matte
Resize that respects your pipeline's math
- image
- get_image_size
- IMAGE
- width
- height
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). Notekeep_proportionis 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_proportionis off by default; that's the default trap. Turn it on unless distortion is the plan. - VAE/module resolution errors downstream - raise
divisible_byto 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_mattedefaults 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_proportionordivisible_byadjusted them; read the outputs instead of trusting your inputs.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 5120–4096 | — |
| height | INT | 5120–4096 | — |
| upscale_method | COMBO | lanczos | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
| keep_proportion | BOOLEAN | false | — |
| divisible_by | INT | 20–512 | — |
| apply_matte | BOOLEAN | false | — |
| matte_width | INT | 5120–4096 | — |
| matte_height | INT | 5120–4096 | — |
| width_inputopt | INT | — | |
| height_inputopt | INT | — | |
| get_image_sizeopt | IMAGE | — | |
| cropopt | COMBO | 2 options: disabled, center |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| width | INT | — |
| height | INT | — |