Nodes/comfyui_bmab/BMAB Square
ComfyUI Node

BMAB Square

Force any image onto a square canvas without cropping it

By portu-sim·Created 2 years ago·Updated 8 months ago· 124
BMAB Square
  • bind
  • image
  • BMAB bind
  • image
method
steps20
cfg_scale8.0
sampler_name
scheduler
denoise1.00
dilation32
size1024
control_net_name

A narrower, more constrained sibling of BMAB Zoom Out: instead of expanding your image onto an arbitrary bigger canvas at whatever ratio you choose, this one specifically pads a non-square image out to a square, filling the new space rather than cropping anything away. Reach for this when something downstream expects a square input - some detection models and some 1:1 platforms want it - and you'd rather extend the canvas than lose content off the edges the way a center-crop would.

The two fill methods

Where Zoom Out gives you four fill methods, Square gives you two:

  • stretching - cheap and fast, stretches edge pixels to fill the new space. Fine when the padding is small or the added strip won't be scrutinized closely.
  • inpaint+lama - runs LaMa (a model built specifically for extending coherent texture into blank regions) followed by a generative pass using your steps/cfg_scale/sampler_name/scheduler/denoise settings, for a fill that actually looks like it belongs.

Notably, Square skips the plain inpaint and controlnet options that Zoom Out offers - it's a more focused tool, not a smaller version of the same one.

The rest of the inputs

  • size (256-4096, default 1024) - the final square dimension, both width and height.
  • dilation (default 32) - how far the fill blends into the original image at the seam.
  • denoise (default 1) - worth noting this defaults to a full redraw rather than the low-denoise touch-up default you'll see on BMAB's detailer nodes, since the padded region is entirely new content with nothing existing to preserve.
  • control_net_name - present in the schema but not actually used by either of Square's two fill methods; it's a leftover-looking field shared with Zoom Out's node family rather than something you need to set here.

Like the rest of BMAB's pipeline, this node takes and returns a bind (the model/clip/vae/seed bundle from an Integrator node), with an optional image input if you want to feed something other than what's already carried in the bind. Output is the updated bind plus the squared-off image.

Installing it

ComfyUI Manager: search comfyui_bmab, install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/portu-sim/comfyui_bmab.git
cd comfyui_bmab
pip install -r requirements.txt

The inpaint+lama method needs LaMa support, which is part of why the README also asks for comfyui_controlnet_aux (Fannovel16) and ComfyUI_IPAdapter_plus (cubiq) installed alongside comfyui_bmab - clone and pip-install both the same way, then restart.

Where people get tripped up

The main one is picking stretching on an image that's a long way from square - a portrait crop padded out to square with stretching alone tends to look obviously smeared along the padded axis, since there's a lot of area for the stretch to cover. Switch to inpaint+lama once the aspect-ratio gap is significant; it costs more compute but the result reads as intentional rather than distorted. The other easy miss is denoise - since it defaults to 1 here, not the ~0.4 you'll see on detail-pass nodes elsewhere in BMAB, dropping it low by habit means the fill region gets a weak, half-formed redraw instead of the coherent full generation this node is built to produce.

CategoryBMAB/resize

Inputs (11)

NameTypeDefaultDescription
bindBMAB bind
methodCOMBO2 options: stretching, inpaint+lama
stepsINT200–10000
cfg_scaleFLOAT8.00–100
sampler_nameCOMBO45 options: Use same sampler, euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, +39
schedulerCOMBO10 options: Use same scheduler, simple, sgm_uniform, karras, exponential, ddim_uniform, +4
denoiseFLOAT1.000–1
dilationINT324–128
sizeINT1024256–4096
control_net_nameCOMBO0 options:
imageoptIMAGE

Outputs (2)

NameTypeDescription
BMAB bindBMAB bind
imageIMAGE