LatentRotate_motorway_edition
Rotate a latent in 90° steps and skip the encode round-trip
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
Want to flip an image 90 degrees? The obvious way is to decode to pixels, rotate, and re-encode - which costs you a lossy VAE round-trip for nothing. LatentRotate_motorway_edition does the rotate directly on the latent, in the compressed space, so it's free and lossless. It just can't do arbitrary angles.
That limitation is the whole deal: this node rotates in 90° steps only - none, 90, 180, 270. The core implementation is a torch.rot90, which is exact and fast because rotating by a right angle in latent space is a clean tensor transpose. For any other angle you're back to pixel space (rotate the image before encoding), but for the common "make this portrait work as a landscape" move, this is the right tool and you never pay the decode-encode tax.
It's also a genuinely handy node for batch juggling: if you generated a batch and want every frame rotated consistently before sampling or before a composite, one node handles the whole stack.
The wrapper
Same Motorway-ed pattern as the rest of the pack - the core LatentRotate node, adapted to read and write the Motorway pipe by key:
MOTORWAY 🚌💨- the pipe. Required.INPUT_samples_key(defaultsamples) - where the latent lives.rotation- enum:none,90 degrees,180 degrees,270 degrees.OUTPUT_LATENT_key(defaultLATENT) - where the rotated latent is stored.
Defaults work with a standard chain: read samples, write LATENT, done. The only output port is the pipe, so grab the result back with a Motorway AxB ramp set to the LATENT key if you want to feed it into a plain node.
One small note on the noise mask: like the core node, the rotation carries any noise mask along with the samples, so masked regions stay aligned after the rotate. That's the sort of detail that only bites you if it's missing.
Installing
The node ships in the Motorway pack:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
# restart ComfyUI
Or ComfyUI Manager → search ComfyUI_agilly1989_motorway → Install. No models, no extra dependencies.
Gotchas
- Start the graph with
MotorwayStart(or a primitive) so there's a pipe. - Keys are exact strings -
Key: 'samples' doesn't exist in motorwaymeans an upstream node stored the latent under a different key. - Beta as always: the author's README says "CURRENTLY IN ACTIVE DEVELOPMENT (BETA)! IF THINGS BREAK ITS BECAUSE I BROKE IT," and the generated clone nodes have been toggled off in some releases. If it's missing from your menu, check the pack's current version.
Needs a 90° multiple? Best path. Needs 45°? Different node. This one's narrow and unapologetic about it.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_samples_key | STRING | samples | — |
| rotation | COMBO | 4 options: none, 90 degrees, 180 degrees, 270 degrees | |
| OUTPUT_LATENT_key | STRING | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |