TTP_SquareImage
The pad-and-resize node Hunyuan3D's pipeline quietly depends on
- image
- padding_color
- Square_Image
In the Comfyui_Hunyuan3D pack, this is the boring node you're supposed to plug in and forget. TTP_SquareImage takes any image, pads it out to a square with a solid color, and resizes it to whatever resolution you ask for - 1024×1024 by default. It exists because Hunyuan3D wants a square image around that size, and a random portrait screenshot isn't one.
It's also genuinely useful outside this pack. Any workflow that wants square inputs - image-to-image, some LoRA training prep, model card thumbnails - can grab this node instead of hand-assembling pad and resize primitives. The implementation is only a few lines of PIL, so it's not doing anything clever, but it does it in one box.
How it works
If the input is already square, it skips the padding step entirely. Otherwise it computes how much extra space the long side needs, splits that padding evenly between left/right and top/bottom, and fills it with your padding_color via PIL's ImageOps.expand. Then it resizes the result to resolution × resolution with the resample method you picked. It's pad-then-resize, not crop - no pixels get thrown away, which is the point of a preprocessing node for a 3D model that wants to see the whole subject.
Inputs that matter
image- any IMAGE tensor, straight out of LoadImage.resolution- 8 to 8096, default 1024, stepping in multiples of 16. 1024 is what Hunyuan3D's pipeline is built around; changing it is mostly for experimentation.upscale_method-nearest-exact,bilinear,area,bicubic, orlanczos. If your source is small and you're upscaling,lanczosis the quality pick;nearest-exactwill look crunchy but keeps hard edges.padding_color- the fill color behind your subject. White (255,255,255) is the default. If your subject is light, white padding blends in; for transparent or dark work you may want black.
The quirk everyone hits
The README warns about this directly: the first time you use the node, click and pick a color in the padding_color widget before running, or it errors. The author says it in so many words - "select a color or it'll error, I don't know why" - and never fixed it. It's the single most common complaint about this node, and the fix is a two-second click.
Output
Square_Image - the padded, resized IMAGE tensor. Wire it into Hunyuan3DNode's image input and you're running the workflow the way the author intended.
Installing
Same as the rest of the pack: ComfyUI Manager, search Comfyui_Hunyuan3D, or
cd ComfyUI/custom_nodes
git clone https://github.com/TTPlanetPig/Comfyui_Hunyuan3D
No extra downloads beyond the pack's own dependencies - unlike Hunyuan3DNode, this node pulls nothing from Hugging Face and is happy on CPU.
One more note: since it pads, it doesn't fix composition. A tiny subject floating in a huge frame still gets resized after padding, so crop toward your subject first. Feed it a decent frame and it's a one-click step you'll never think about again.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| resolution | INT | 10248–8096 | — |
| upscale_method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, lanczos | |
| padding_color | COLOR | 255,255,255 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Square_Image | IMAGE | — |