Image Square Adapter Node
Fit any image into a square with padding, no cropping
- image
- IMAGE
Take any image, of any shape, and drop it centered into a square canvas without cutting anything off - that's this node. It scales your picture to fit inside a square of the size you choose and fills the leftover space with a solid color (white by default). The whole image survives; you just get bars on two sides, like letterboxing. In the menu it's Image Square Adapter Node.
The default target_size of 224 is the classic CLIP / image-classifier input size, so the author clearly built this to feed encoders and vision models - but it's equally handy for making consistent square thumbnails or prepping a clean 1024 square before generation.
How it works
The image is resized to fit inside the square (the longer side matches target_size, the shorter side is centered), and the gap is painted with fill_color. This is the padding/letterbox approach, the opposite of a crop: nothing is thrown away, so a wide image gets bars top and bottom, a tall one gets bars left and right.
fitting_mode shifts where the image sits within the square - center puts it dead center, top and bottom push it against an edge, none leaves the default placement. resampling is the scaling filter, and lanczos is the right default for clean, non-hallucinated resizing.
The inputs and outputs that matter
image- the image in.target_size- the square's side length in pixels.fill_color- the padding color as a comma-separated RGB string."255,255,255"is white; use"0,0,0"for black.
Then fitting_mode (none/top/bottom/center - where the image sits), resampling (keep lanczos), and supersample (true/false - render bigger then downsample for smoother edges).
Output: a single square IMAGE at target_size x target_size.
Installing it
ComfyUI Manager: search ComfyUI_Nimbus-Pack, install, restart. Small pack - if it's not indexed, clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/sergekatzmann/ComfyUI_Nimbus-Pack.git
pip install -r ComfyUI_Nimbus-Pack/requirements.txt
Restart. Pure PIL/NumPy, no models. The requirements.txt is for the pack's video node.
Common issues & troubleshooting
fill_color is a string, not a color picker. This trips people up. It wants three comma-separated numbers, "R,G,B", each 0–255 - no #hex, no spaces needed. "255,255,255" white, "0,0,0" black, "128,128,128" mid-grey. Type it wrong and you'll either get an error or the default.
You wanted it to fill the frame, not pad it. If bars bug you and you'd rather crop to fill, use the pack's Image Resize And Crop node instead - that one covers the target and crops the overflow. Square Adapter is specifically the keep-everything, add-bars option.
Feeding an image encoder? Mind the padding color. For CLIP-style preprocessing the convention is usually a neutral fill; a loud fill_color becomes part of what the model "sees." White or black is safest unless you have a reason otherwise.
Only need a square for a model that wants one specific size? Set target_size to match it exactly (224 for many CLIP variants, 512 or 1024 for diffusion) rather than resizing again downstream.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_size | INT | 2241–10000 | — |
| fill_color | STRING | 255,255,255 | — |
| resampling | COMBO | lanczos | 4 options: lanczos, nearest, bilinear, bicubic |
| supersample | COMBO | false | 2 options: true, false |
| fitting_mode | COMBO | none | 4 options: none, top, bottom, center |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |