素材拆分(带透明通道) / Sprite Splitter RGBA
Sprite splitting that keeps the transparency
- 图像
- 图像列表
- 遮罩列表
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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| 图像 | IMAGE | 待拆分的合图,需自带透明通道(背景为透明)。 节点按 alpha 的连通区域找出各个独立素材并逐个裁出。 白底图请先接抠图节点转成透明再进来,否则整图会被当成一块。 | |
| 最小面积过滤(像素数) | INT | 1001–50000 | 最小面积过滤。 |
| 裁剪边距 | INT | 20–50 | 裁剪边距(像素)。 |
| 排序方式 | COMBO | 从左到右-从上到下 | 输出顺序。 ⚠ 逐帧处理动画序列时慎用:素材位置一旦浮动跨过内部 行/列分界,顺序就会在帧间改变。那种场景请改用 「八方向序列拆分」节点(按固定网格定位,顺序恒定)。 |
| seed | INT | 00–18446744073709550000 | 随机种子:仅用于强制重新执行节点,不影响实际拆分结果。 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 图像列表 | IMAGE | — |
| 遮罩列表 | MASK | — |