Nodes/RUI-Nodes/素材拆分(带透明通道) / Sprite Splitter RGBA
ComfyUI Node

素材拆分(带透明通道) / Sprite Splitter RGBA

Sprite splitting that keeps the transparency

By rui40000·Created 3 years ago·Updated 13 days ago· 17
素材拆分(带透明通道) / Sprite Splitter RGBA
  • 图像
  • 图像列表
  • 遮罩列表
最小面积过滤(像素数)100
裁剪边距2
排序方式从左到右-从上到下
seed0

RuiSpriteSplitterRGBA is the version of the sprite splitter that keeps your transparency. The plain Sprite Splitter crops each element out of a sheet and fills the transparent areas with white; this one does the same crop but also hands you each element's alpha channel as a mask, so you can rebuild genuinely transparent PNGs downstream. If you're extracting game characters, props, or icons that need clean transparent backgrounds, this is the node to reach for - the plain variant is for when you just want the shapes on a white card.

It shares its entire skeleton with the base splitter, and the same golden rule applies: it splits on the alpha channel. The input sheet must already have real transparency - meaning you run it on an RGBA image that came out of a background-removal node (BiRefNet, rembg, and friends - all of that context is in the KB's background-removal essay if you want the lay of the land). A white-background sheet with no alpha will come through as one single connected component, which is not the splitting you wanted.

How it works

Identical mechanism to the base node: threshold the alpha, run connected-component labeling, crop each element to its bounding box. The inputs are the same five:

  • 图像 - the sheet, with transparency.
  • 最小面积过滤(像素数) - drop components smaller than this (default 100).
  • 裁剪边距 - padding around each crop (default 2).
  • 排序方式 - output ordering (reading order, or by area).
  • seed - cache-buster only, no effect on output.

The difference is the outputs:

  • 图像列表 - the cropped RGB images, one per element.
  • 遮罩列表 - the matching alpha masks, one per element. 1.0 = opaque, 0.0 = transparent.

The pack README suggests wiring the mask list into JoinImageWithAlpha-style nodes to rebuild transparent PNGs, which is exactly the right pattern: RGB from the first output, alpha from the second, and you've got a clean RGBA asset per sprite.

Installing it

Part of the RUI-Nodes pack ("Rui-Node🐶"). Install once via ComfyUI Manager (search "RUI-Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/rui40000/RUI-Nodes
cd RUI-Nodes
pip install -r requirements.txt

Restart after. Needs scipy for the component labeling - in the pack's requirements already.

Where people get burned

The same traps as its sibling, plus one more: if you wire the alpha masks into a compositor, remember they're already inverted to the convention that compositor expects - check one output visually before you build the whole pipeline. And the "sheet must have real alpha" rule applies twice here, because the whole point is preserving that alpha. A white-background sheet fails silently into one giant component, and no amount of knob-turning fixes it - cut the background out first. Overlapping elements still merge, so keep your source sprites separated.

CategoryRui-Node🐶/图像调节🎨

Inputs (5)

NameTypeDefaultDescription
图像IMAGE待拆分的合图,需自带透明通道(背景为透明)。 节点按 alpha 的连通区域找出各个独立素材并逐个裁出。 白底图请先接抠图节点转成透明再进来,否则整图会被当成一块。
最小面积过滤(像素数)INT1001–50000最小面积过滤。
裁剪边距INT20–50裁剪边距(像素)。
排序方式COMBO从左到右-从上到下输出顺序。 ⚠ 逐帧处理动画序列时慎用:素材位置一旦浮动跨过内部 行/列分界,顺序就会在帧间改变。那种场景请改用 「八方向序列拆分」节点(按固定网格定位,顺序恒定)。
seedINT00–18446744073709550000随机种子:仅用于强制重新执行节点,不影响实际拆分结果。

Outputs (2)

NameTypeDescription
图像列表IMAGE
遮罩列表MASK