ComfyUI Node

Rotate Image

Rotating images at any angle in ComfyUI — the one thing the core node can't do

By M1kep·Created 3 years ago·Updated 2 years ago· 0
Rotate Image
  • image
  • IMAGE
rotation0
sampler

ComfyUI's built-in ImageRotate node only turns images in 90-degree steps. Fine for fixing a sideways photo, useless the moment you want to tilt something 15° because it looks better framed diagonally - which, it turns out, people want to do all the time for compositions, product shots, and "scan" effects. KepRotateImage is the kitchen-sink answer: a dead-simple node that rotates an image by any angle from 0 to 360 degrees.

It lives in a tiny pack called Comfy_KepKitchenSink - the name is the whole pitch. It's a grab-bag of small image utilities, and this rotate node is the one you're actually likely to reach for. It's not doing anything clever under the hood, and that's exactly why it works.

How it works

The node is a thin wrapper around PIL's Image.rotate(). It converts the input tensor to a PIL image, rotates it around the center with the resampling filter you pick, and converts the result back to a tensor. That means it runs on CPU, takes milliseconds, needs zero model files, and doesn't touch your GPU at all. If you were hoping for a "rotated latent" node, this isn't it - you're rotating a decoded image, so put it after VAE decode and before anything that consumes pixels.

Three inputs, and only two of them matter:

  • image - the IMAGE tensor to rotate.
  • rotation - an integer from 0 to 360, default 0. Positive values rotate counter-clockwise (that's a PIL convention that bites people constantly). Want a clockwise 90°? That's 270. There's no negative numbers and no expand toggle - both worth knowing before you wire it in.
  • sampler - the resampling filter: nearest, lanczos, bilinear, bicubic, box, hamming. For ordinary photos, lanczos or bicubic give the smoothest result. If you're rotating pixel art or anything with hard edges, use nearest or you'll get a smeary mess.

The output is a single IMAGE tensor, same shape as the input, ready to feed a Save Image node, an upscaler, or anything else downstream.

The trap: your corners go black

Here's where people get burned. PIL's rotate with expand=False - which is all this node does - keeps the canvas the same size as the input and rotates the content inside it. Rotate a 1024×1024 image 45° and you get a diamond clipped to a square, with big black triangles in the corners. There's no option to expand the canvas or set a fill color, so those triangles are black, period.

If that's not what you want - and for most real use it isn't - you have two options. Feed it angles close to 90/180/270 where the clipping is small, or use a node that supports canvas expansion (other packs like WAS Node Suite's Image Rotate have an expand option). The tradeoff with expand is you get a bigger image with transparent or black borders you then have to crop or composite - that's the normal trade, just know it's not available here.

One more gotcha: this node processes a single image at a time. Feed it a batch of images and the squeeze() in its tensor conversion will blow up. Split your batch first or run it per image.

Installing it

The pack is one tiny repo with no requirements.txt, no models, nothing heavy - just drop it in. Easiest way is ComfyUI Manager: search for Comfy_KepKitchenSink and install. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/M1kep/Comfy_KepKitchenSink

Restart ComfyUI and the node shows up as Rotate Image under KepKitchenSink/images. No extra Python packages, no downloads, no dependency hell - which is more than you can say for most custom nodes.

Verdict

It's a utility node with one job and roughly the depth you'd expect from a one-commit kitchen-sink pack. For the rare arbitrary-angle job - tilt an image 12°, straighten a crooked scan - it does the thing and gets out of the way. Just remember the black corners, and don't feed it batches.

CategoryKepKitchenSink/images

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
rotationINT00–360
samplerCOMBO6 options: nearest, lanczos, bilinear, bicubic, box, hamming

Outputs (1)

NameTypeDescription
IMAGEIMAGE