Auto Image Resize
Auto Image Resize
- image
- IMAGE
- MASK
Most "resize" nodes stretch or crop. This one does neither. Auto Image Resize scales your image down to fit inside a target box, keeps the aspect ratio, centers it on a canvas of exactly the dimensions you asked for, and - this is the part people miss - hands you a feathered mask of where the real image sits versus the empty padding around it. That mask is the whole point.
Why you'd reach for it
Think about outpainting. The pattern is always the same: you put a picture on a bigger canvas, mask the empty area you want the model to invent, and let it fill. The KB's outpainting notes spell out what makes that work or fail - you want generous overlap and adequate mask blur so the extension doesn't look pasted on. Auto Image Resize does the annoying setup for you in one node. Point it at, say, a 1024×1024 canvas, feed it a 768×1024 portrait, and you get the portrait centered with pillarbox bars on the sides plus a soft-edged mask marking exactly those bars. Invert it, wire it into your inpaint conditioning, prompt for what belongs there, done.
It's also just a clean "fit to canvas without distortion" node for when you need a fixed output size - thumbnails, a consistent grid, feeding something that demands an exact resolution - and you'd rather letterbox than squash a face into an egg.
How it works
Aspect-preserving downscale to fit the target, center on a blank canvas of the target size, then build a mask over the pasted image with the edges feathered inward. Nothing exotic - but the feathering is what turns a hard rectangular paste into something a diffusion model can blend against instead of leaving a visible seam.
The inputs that matter
- target_width / target_height - the canvas you're fitting into. Both step in multiples of 8, which is the alignment diffusion models want anyway, so set them to a real generation resolution (1024, 1216, 832…) rather than an arbitrary number.
- feathering - how many pixels of soft falloff on the mask edge, default 40. For tight inpaint fixes the KB says 4–12px is typical, but this node is doing outpainting-scale blending, so a chunky 40 is a sensible default. Push it higher for a softer hand-off, lower if the blur is bleeding the fill into your subject.
Outputs are IMAGE (the resized, centered, padded result) and MASK (the feathered area covering the real image). Wire IMAGE onward as your working image; send MASK into whatever compositing or inpaint node you're using - remembering that the mask marks the image, so if you want to paint the padding you invert it first.
Installing it
Search ComfyUI Manager for "ComfyUI Unusual Tools" and install, then restart. If it's not in the registry - it's a small, low-profile pack, so don't be shocked - clone it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/Diohim/ComfyUI-Unusual-Tools
Restart ComfyUI and it shows up under image/transform. No model downloads, no pip wheels to fight - it leans on the PIL/numpy/torch stack ComfyUI already ships. One heads-up: the README's own copy-paste git clone line still has a yourusername placeholder in the URL, so don't paste that one blindly - use the real repo path above.
Where people get tripped up
The mask polarity is the recurring confusion. "MASK: a mask for the resized area" means the mask is on your image, not on the empty space - so for outpainting you almost always want to invert it before feeding an inpaint node, otherwise you'll regenerate your subject and preserve the void, which is backwards.
Both target dimensions default to 0, and 0 is not a resolution - treat these as required fields you actually fill in, not something to leave alone. And since the node fits rather than crops, an aspect ratio wildly different from your canvas gives you thick bars; if that bugs you, pick a target ratio closer to the source, or lean into it and outpaint the bars away, which is the whole reason the mask exists.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_width | INT | 00–8192 | — |
| target_height | INT | 00–8192 | — |
| feathering | INT | 400–8192 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |