KoO Krea Still Latent → 4D
Krea's 5D Latent Back to Normal
- latent
- LATENT
- shape_report
A Krea 2 still-image latent arrives as [B, C, 1, H, W]. Five dimensions, one of which is a temporal axis holding a single frame. Half the nodes you want to use - upscalers, detailers, most ControlNet paths, a lot of tiled samplers - were written against plain [B, C, H, W] and will either throw a shape error three nodes downstream or, worse, quietly reshape your batch and produce something strange.
KoO Krea Still Latent → 4D is the one-line fix: check the tensor is 5D with a singleton at index 2, squeeze it, hand you back a 4D latent. No widgets, no settings, nothing to tune. Its mirror image, KoO 4D → Krea Still Latent, does the reverse unsqueeze when you need to go back.
Why bother having a node for this
Because in ComfyUI the failure doesn't happen where the mistake is. A latent is a plain dict with a samples tensor; nothing type-checks its rank at the socket. The mismatch surfaces wherever some node does its first view() or matches against shape[-2:], and by then the traceback names a node you never touched. Once you know the pattern - "shape error mentioning 5 dimensions" or "expected 4D got 5D" - a two-node adapter in the right place is a ten-second fix instead of twenty minutes of reading stack traces.
Inputs, outputs, behaviour
One input: latent (LATENT). One meaningful output: LATENT. Plus, usefully, shape_report (STRING), which returns something like:
squeezed singleton temporal dimension at index 2: (1, 16, 1, 96, 64) -> (1, 16, 96, 64)
Wire that to a text preview while you're setting things up. It's the fastest confirmation that you used the right direction of adapter, and it costs nothing when disconnected.
The node copies the latent dict and swaps only samples, so anything else riding along on it - masks, metadata a loader attached - stays intact. It's also idempotent in the useful direction: feed it a plain 4D latent and it passes through unchanged with "already 4D; passed through unchanged". So you can leave it in a graph permanently without breaking the runs that are already fine.
The one thing it refuses is a 5D latent whose temporal dimension isn't 1. Hand it an actual multi-frame video latent and it raises with the shape rather than flattening your animation into a single frame. That's the correct, unobvious call - a silent squeeze there would be a data-loss bug.
Where it goes in the pipeline
Rule of thumb: put it immediately after whatever produced the 5D latent, before you hand the latent to any node from the broader ecosystem. Loaders and samplers built for Krea will want it 5D; upscalers, detailers, and mask operations usually want 4D. The adapter goes at the boundary, not in the middle.
If your graph needs to come back the other way - 4D latent into a Krea-shaped consumer - pair it with KoO 4D → Krea Still Latent. Both nodes live in the same file in this pack and both are filed under KoO/Latent Compatibility, so you'll see them together on the add-node list. Read the arrow in the display name: Krea Still Latent → 4D squishes, 4D → Krea Still Latent stretches.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/kevintronchin-blip/koo-nodes-pack
Restart ComfyUI. Nothing to pip install (the pack's requirements.txt is aiohttp, numpy, Pillow, torch, all already supplied by ComfyUI), no models to download, no frontend component - so it works under either renderer.
Registry/Manager availability at v1.0.3 depends on moderation approval; if Manager search finds nothing, use the README's ZIP route and extract to ComfyUI/custom_nodes/koo-nodes-pack with __init__.py directly inside.
The two mistakes
Squeezing when you should stretch. The two nodes look identical on a canvas - one socket in, one out, plus a text output. If the error says something expected 5D and got 4D, you need the other one. It's the most common wrong-turn with this pair and it costs a queue cycle to notice.
Blaming the adapter for a batch problem. This moves rank, not batch. If a batch of six is arriving where one image was expected, that's list/batch semantics - the carousel nodes and ComfyUI's list broadcasting - and no amount of squeezing helps.
Otherwise: it's a genuinely boring node that solves a genuinely annoying problem, which is the best thing a compatibility adapter can be.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |
| shape_report | STRING | — |