Nodes/ComfyUI/Rotate Latent
ComfyUI Node Runs on cloud

Rotate Latent

Spin your image before it's even an image

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,962
Rotate Latent
  • samples
  • LATENT
rotation

Rotate Latent does exactly one thing: spins a latent 90, 180, or 270 degrees - the only options, and deliberately so. No arbitrary angles, no rotation math with blurry edges. It's torch.rot90 on the latent tensor, which means it's instant, lossless, and works on video latents too (the rotation applies across the spatial axes, leaving frames intact).

The single input is rotation: none, 90 degrees, 180 degrees, or 270 degrees. Feed it any LATENT, get the same LATENT turned around. That's the whole node - which makes it easy to underestimate.

Why rotate a latent instead of the image?

Because rotation happens before the sampler, and there are workflows where that ordering is the whole point. The big one is generating at a resolution the model likes, then turning the result. Say you want a tall portrait but the model's sweet spot is landscape - generate landscape, rotate the latent 90°, and you've got a portrait-sized canvas. More practically: it's how you straighten a latent you're about to composite, or how you make a video latent's orientation match the model's training distribution before a second pass.

The genuinely useful trick is combining it with composite or crop nodes. Outpainting a vertical image usually means rotating the latent to landscape, extending horizontally, and rotating back - and because rotation is exact, nothing drifts from the round trip.

What it can't do

It's four-position rotation only. If you need a 45° tilt, that's not this node - you're in pixel space with Image Rotate territory, and the moment you interpolate, you've paid for it with softness. Latent space has no arbitrary-angle version because resampling a latent introduces artifacts that show up as mush after decode; the model never saw rotated latents in training, so any angle the node can't do losslessly is an angle it won't do.

One thing to double-check: rotation operates on the latent grid, which for an 8×-downscaled model means your 1024×1024 image is a 128×128 latent being turned. That's exact. But if you rotate a latent whose dimensions aren't square, remember the pixel dimensions swap - a 512×768 latent rotated 90° decodes as 768×512. Obvious, and easy to forget when you're wiring coordinates downstream. And the real trap: if you've set a noise mask, the mask does not get rotated - the source only spins samples, so a mask set before the rotation ends up misaligned with the latent after it. Rotate first, mask second, same rule as Crop Latent.

It ships with ComfyUI core, no install. It's a two-input node you'll use rarely and appreciate in the moment - the sort of thing that looks trivial until you're building a latent pipeline and realize "wait, I need to flip this before sampling."

Categorymodel/latent/transform

Inputs (2)

NameTypeDefaultDescription
samplesLATENT
rotationCOMBO4 options: none, 90 degrees, 180 degrees, 270 degrees

Outputs (1)

NameTypeDescription
LATENTLATENT