Add Latent Split node (2/4 spatial split) for ComfyUI
Splits a [B,C,H,W] latent into left/right or top/bottom halves, or four quadrants. Model-agnostic (SD, SDXL, Flux / FLUX.1 Krea); preserves batch dimension and noise_mask. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# ComfyUI-Latent-splitter
|
||||
|
||||
A ComfyUI custom node that splits a latent into **2** (left/right or top/bottom)
|
||||
or **4** tiles along its spatial axes.
|
||||
|
||||
It is model-agnostic — it only slices the height/width of the `[B, C, H, W]`
|
||||
latent tensor, so it works with SD/SDXL (4-channel) and Flux / **FLUX.1 Krea**
|
||||
(16-channel) latents alike. A `1024×1024` image (a `128×128` latent) splits into
|
||||
two `512×1024` halves or four `512×512` quadrants.
|
||||
|
||||
## Node: Latent Split (2 / 4)
|
||||
|
||||
**Category:** `latent`
|
||||
|
||||
**Inputs**
|
||||
|
||||
| Input | Type | Notes |
|
||||
|--------|--------|-------|
|
||||
| `samples` | LATENT | The latent to split. |
|
||||
| `mode` | choice | `left / right`, `top / bottom`, or `quad (4)`. |
|
||||
|
||||
**Outputs** — filled in reading (row-major) order:
|
||||
|
||||
| Mode | latent_1 | latent_2 | latent_3 | latent_4 |
|
||||
|------|----------|----------|----------|----------|
|
||||
| `left / right` | left | right | — | — |
|
||||
| `top / bottom` | top | bottom | — | — |
|
||||
| `quad (4)` | top-left | top-right | bottom-left | bottom-right |
|
||||
|
||||
Unused outputs (3 and 4 in the two-way modes) return `None` — leave them
|
||||
unconnected. Odd latent dimensions split with the extra row/column going to the
|
||||
second tile. The batch dimension and any `noise_mask` are preserved (the mask is
|
||||
sliced to match each tile).
|
||||
|
||||
## Install
|
||||
|
||||
Clone into your ComfyUI `custom_nodes` directory:
|
||||
|
||||
```bash
|
||||
cd ComfyUI/custom_nodes
|
||||
git clone https://github.com/ethanfel/ComfyUI-Split-Latent.git
|
||||
```
|
||||
|
||||
No extra dependencies — it uses the PyTorch that ships with ComfyUI. Restart
|
||||
ComfyUI and find the node under **Add Node → latent → Latent Split (2 / 4)**.
|
||||
Reference in New Issue
Block a user