BMAB Resize By Person
Auto-detect the subject, then frame around them
- bind
- image
- BMAB bind
- image
This is one of the more genuinely clever nodes in the pack: instead of you deciding how to crop or pad a portrait, it finds the person in the frame, figures out how much of the canvas they should occupy, and fills the rest - with a full choice of how aggressively that fill is generated. The pack's README credits person-aware detection to Grounding DINO, which ships inside the transformers library (v4.40.0+) with no separate install needed. That's the mechanism doing the "find the person" half of this node's name.
How it works
ratio (default 0.85) is the core idea: it's the fraction of the output canvas the detected person should fill, so 0.85 means the subject takes up 85% of the frame with a modest margin around them. alignment decides which edge the crop anchors to - bottom keeps feet grounded for a standing full-body shot, top anchors a head, and center splits the difference - pick based on what you're actually trying to compose. dilation (default 30) pads the detection box before the framing math runs, giving a bit of breathing room so the crop doesn't hug the detected bounding box too tightly.
The actual resize happens via method: stretching is the cheap option (fast, can distort proportions if the target ratio is far from the source), inpaint runs a real diffusion fill using steps, cfg_scale, sampler_name, scheduler, and denoise, and inpaint+lama runs BMAB's LaMa node first for a fast structural fill before a diffusion pass refines it - worth trying if plain inpaint alone is giving you visible seams. Note that sampler_name and scheduler both offer a "Use same sampler" / "Use same scheduler" option at the top of their lists - pick that and this node inherits whatever your main KSampler is already using instead of you having to keep two sets of sampler settings in sync by hand.
The inputs and outputs that matter
bind(required) - the BMAB pipeline object; this node samples through it.ratio(default 0.85, 0.1–0.95) - how much of the frame the detected person should fill.alignment(enum, 9 options:bottom,top,center, and the four corners plus edges) - which side the crop anchors to.method(stretching/inpaint/inpaint+lama) - how the non-subject area gets filled.dilation(default 30, 4–128) - padding around the detection box.steps,cfg_scale,sampler_name,scheduler,denoise- only meaningfully matter whenmethodinvolves inpainting.- Optional
image- feed in a source directly if you're not carrying one on the bind already. - Outputs:
BMAB bindandimage.
How to install it
ComfyUI Manager: search comfyui_bmab. Manual, plus its two companion packs:
cd ComfyUI/custom_nodes
git clone https://github.com/portu-sim/comfyui_bmab.git
cd comfyui_bmab
pip install -r requirements.txt
Fannovel16/comfyui_controlnet_aux and cubiq/ComfyUI_IPAdapter_plus are both required per the README and already ship in ComfyICU's shared image.
Common issues & troubleshooting
A crash mentioning GroundingDinoProcessor.post_process_grounded_object_detection() and an unexpected box_threshold argument. This is a real, reported failure - a ComfyUI user hit exactly this error running BMAB's nodes, and changing transformers versions didn't fix it for them. The README's claim that Grounding DINO "just works" from transformers 4.40.0+ is true for the version it was written against, but the function's keyword arguments have shifted across later transformers releases, and BMAB's code calling it can drift out of sync with whatever version you have installed. If you hit this, check your installed transformers version against what the rest of your environment (and any other node packs relying on it) actually needs - pinning is often the fix, but pin carefully since other packs may want a different version.
No person detected, or the crop looks arbitrary. Grounding DINO detection can miss subjects that are small in frame, heavily obscured, or in unusual poses. If the framing looks wrong, it's worth first confirming detection actually found the person rather than assuming the ratio/alignment math is at fault.
Visible seam where the fill meets the original. Try inpaint+lama over plain inpaint - the LaMa pre-pass often produces a cleaner structural base for the diffusion step to refine, especially on simple backgrounds.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| bind | BMAB bind | — | |
| steps | INT | 200–10000 | — |
| cfg_scale | FLOAT | 8.00–100 | — |
| sampler_name | COMBO | 45 options: Use same sampler, euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, +39 | |
| scheduler | COMBO | 10 options: Use same scheduler, simple, sgm_uniform, karras, exponential, ddim_uniform, +4 | |
| denoise | FLOAT | 0.500–1 | — |
| method | COMBO | 3 options: stretching, inpaint, inpaint+lama | |
| alignment | COMBO | 9 options: bottom, top, top-right, right, bottom-right, bottom-left, +3 | |
| ratio | FLOAT | 0.850.1–0.95 | — |
| dilation | INT | 304–128 | — |
| imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| BMAB bind | BMAB bind | — |
| image | IMAGE | — |