Nodes/Banana Gemini Image Generator/Mask遮罩❤️‍🔥心宝专用
ComfyUI Node

Mask遮罩❤️‍🔥心宝专用

A mask, its tightest box, and the alignment that keeps local edits honest

By 98624017·Created 9 months ago·Updated 5 months ago· 2
Mask遮罩❤️‍🔥心宝专用
  • binding_context
  • mask
  • image_optional
  • MASK
  • IMAGE
  • x
  • y
  • width
  • height
padding0
blur0

Named "MaskBoundingBoxAligned," which tells you most of what it does: it takes a mask, crops it down to its tight bounding box, and aligns that crop to a binding context. The alignment part is the whole point - this node ships as part of the 心宝 Banana pack's local-edit chain, where a crop that's off by a few pixels shows up as a visible seam when you paste back.

It's one of two segmentation nodes the pack bundles in from the author's separate segment_nodes_li set (the README notes the pack carries them, no extra install needed). And it has one unusual requirement: binding_context is a required input, and the tooltip says it will refuse to run without it. This is the node that makes sure a mask crop lines up with the image geometry the Banana node was told to treat as fixed.

The inputs

  • binding_context (BANANA_BINDING) - required, from 心宝❤绑定生成 / the passthrough. Missing it → the node errors out rather than guessing. This is deliberate: an unaligned crop would silently corrupt the whole local-edit chain.
  • mask (MASK) - the mask you want the bounding box of. Typically from the SAM node below it in the pack's menu, or hand-drawn.
  • padding (0–4096, default 0) - extra pixels added around the tight bounding box. The same idea as the preprocess node's padding: give the regenerated region a little context so the edit doesn't clip at the box edge.
  • blur (0–256, default 0) - blurs the cropped mask's edges by N pixels, which softens the transition when the region is regenerated and pasted. Zero means hard edges.
  • image_optional - if you pass the source image too, the node can also give you back the cropped region as an image, which makes previewing what you're about to regenerate trivial.

The six outputs

MASK and IMAGE (the cropped, padded, aligned mask and the corresponding image crop), plus x, y, width, height as plain INTs. Those four numbers are the bounding box in the original image's coordinate space - the geometry other nodes need to place things back precisely. If you've ever hand-copied x/y/w/h out of a mask node into a crop node, this is the version that does it for you, aligned to the binding to boot.

How it fits the chain

The pack's local-edit flow goes: SAM node produces a mask from a text prompt → this node trims and aligns it → BananaLocalCropPreprocess preps the crop → Banana regenerates → BananaLocalCropPaste puts it back. The padding and blur here feed the same goal as the preprocess node's sliders - a padded, soft-edged region pastes back invisibly; a hard-edged, tight-box region shows its rectangle.

Installing

Same pack, same one-liner:

cd ComfyUI/custom_nodes
git clone https://github.com/98624017/comfyui-banana-li-linux

Restart ComfyUI. It depends on opencv-contrib-python from the pack's requirements - no model downloads, this is pure geometry on a mask you already have.

The trap to remember: because binding_context is required and enforced, this node will refuse to run in any workflow that doesn't set up the binding chain first. If you drop it into a plain masking workflow and it errors, that's the intended guard, not a bug - give it a binding context or use a non-aligned bounding-box node instead.

Category❤️‍🔥心宝专用/掩膜

Inputs (5)

NameTypeDefaultDescription
binding_contextBANANA_BINDING来自“心宝❤绑定生成/透传”的绑定上下文,缺失将拒绝执行
maskMASK
paddingINT00–4096
blurINT00–256
image_optionaloptIMAGE

Outputs (6)

NameTypeDescription
MASKMASK
IMAGEIMAGE
xINT
yINT
widthINT
heightINT