Image Resize π
One node that finally handles aspect, masks, and clean multiples
- image
- mask
- image
- mask
- width
- height
Image Resize π is the resize node that thinks about the whole job, not just "make it bigger." It resizes an image to a width+height, a longest or shortest edge, a megapixel budget, or a scale factor - and when the aspect ratio changes, it can stretch, fit inside, center-crop to cover, or pad with a fill color. It optionally carries a mask through the exact same geometry, snaps the result to a clean multiple, and hands back the final dimensions as numbers you can wire into latent nodes. In a pack, that's usually a chain of three or four nodes plus a mask detour; the pack's own changelog says the point was to kill the most common reason a shared workflow drags in a heavy node suite - one dependency-free node instead.
The divisible-by detail is the one that makes it feel built for modern models. Many samplers, VAEs, and video models behave best on cleanly divisible sizes - 16 for WAN video, 8 for most latent spaces - and a resize that lands on an odd dimension can quietly produce artifacts at the latent stage. divisible_by (default 1) snaps each output dimension to the nearest multiple, and the node is explicit that the snap is resolved by a real sub-half-step resize, never by inventing pixels. So "divisible by 16" means a resize happens to land on the multiple, not that extra pixels get smeared into the edge.
How it works
target_mode picks which widgets matter: width+height reads width and height; longest_edge/shortest_edge scale until that edge hits edge_length; megapixels scales to a pixel budget (about that many million pixels, aspect preserved); scale_factor multiplies the source (0.5 halves both dimensions). A 0 in a size widget keeps the source dimension - and if only one of width or height is set, the other follows to preserve aspect.
When the target box doesn't match the source aspect, keep_proportion decides: stretch distorts to the exact box; fit shrinks the box to the source aspect (output may be smaller than you asked, no bars); cover_crop fills the box and center-crops the overflow; pad fits inside and fills the rest with fill_color - and here's the clever bit, the new bars come out as 1.0 in the mask output, so you get a ready outpaint mask for free. The other target modes derive their box from the source itself, so they never crop or invent pixels regardless of this setting. interpolation defaults to lanczos (the sharp all-rounder), with bicubic, bilinear, nearest (for pixel art and masks), and area (best for strong downscales).
Outputs: image (the resized batch), mask (the optional input mask through the identical transform; all zeros if none wired), and width/height as INTs - wire those straight into an Empty Latent or a sampler size.
Install
ComfyUI Manager is the easy route: search for ComfyUI-AusBoss under Custom Nodes and hit Install, then restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ausboss/ComfyUI-AusBoss.git
Restart ComfyUI and Image Resize π sits under π AusBoss/Image. No extra Python dependencies - the resize runs on Pillow and Torch that ComfyUI already ships. Minimum ComfyUI 0.27.1, and hard-refresh with Ctrl+Shift+R after frontend updates.
Common issues
The traps are the two defaults you might not read closely. keep_proportion only crops or pads in width+height mode - the edge/megapixel/scale modes derive the box from the source, so don't expect a pad there. And megapixels is a budget, not a guarantee: it targets "about" that many million pixels, so don't be surprised by a rounding sliver. If you're feeding a WAN video model, set divisible_by to 16 and don't rely on remembering to. For masks, nearest interpolation is usually the right call - a soft lanczos feather on a hard mask edge will bleed into your inpaint region.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | BHWC image batch to resize. | |
| target_mode | COMBO | width+height | What sets the output size: width+height reads the two size widgets; longest_edge and shortest_edge scale until that edge hits edge_length; megapixels scales to a pixel budget; scale_factor multiplies the source. Each mode reads only its own widget(s). |
| width | INT | 00β16384 | Target width for width+height mode. 0 keeps the source width, or follows height to preserve the aspect when only height is set. |
| height | INT | 00β16384 | Target height for width+height mode. 0 keeps the source height, or follows width to preserve the aspect when only width is set. |
| edge_length | INT | 10240β16384 | Target length for the longest_edge and shortest_edge modes; the chosen edge lands exactly here and the other keeps the aspect. 0 keeps the source size. |
| megapixels | FLOAT | 1.000β64 | Pixel budget for megapixels mode: the image scales (aspect preserved) until width x height is about this many million pixels. 0 keeps the source size. |
| scale_factor | FLOAT | 0.500β16 | Multiplier for scale_factor mode: 0.5 halves both dimensions, 2.0 doubles them. 0 keeps the source size. |
| keep_proportion | COMBO | fit | When the width+height box differs from the source aspect: stretch distorts to the exact target; fit shrinks the target box to the source aspect (output may be smaller than requested, no bars); cover_crop fills the target and center-crops the overflow; pad fits inside and fills the rest with fill_color, marking the bars in the mask output. The other target modes derive the box from the source itself, so they never crop, distort visibly, or invent pixels regardless of this setting. |
| fill_color | STRING | #000000 | Bar color for pad mode; accepts #RGB/#RRGGBB hex, R, G, B (0-255 or 0..1 floats), one grayscale number, or a CSS color name. Other modes ignore it. |
| divisible_by | INT | 11β1024 | Snaps each output dimension to the nearest multiple of this (never below one step) - set 16 for WAN, 8 for most latent spaces. 1 leaves sizes exactly as computed. The snap is always resolved by a sub-half-step resize, never by inventing pixels. |
| interpolation | COMBO | lanczos | Resampling filter: lanczos is the sharpest all-rounder, bicubic and bilinear are softer, nearest keeps hard pixels (pixel art, masks), area is best for strong downscales. |
| maskopt | MASK | Optional BHW mask carried through the exact same resize, crop, and pad geometry as the image. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The resized image batch in BHWC format. |
| mask | MASK | The input mask through the identical transform; in pad mode the new bars are 1.0 (a ready outpaint mask). All zeros when no mask is wired. |
| width | INT | Output width in pixels. |
| height | INT | Output height in pixels. |