Nodes/NIX ComfyUI Plugin/NIX_RotateImage
ComfyUI Node

NIX_RotateImage

Rotate a batch of images — and their masks together — without chopping the corners off

By J-ChenX·Created 11 months ago·Updated 11 months ago· 2
NIX_RotateImage
  • images
  • masks
  • images
  • masks
angle0
flip_horizontalfalse

NIX_RotateImage is the node you use when you need to rotate images and keep the masks in perfect lockstep with them. It takes a batch of images, rotates them all by an angle, optionally mirrors them, and - the part that makes it useful for real pipelines - does the exact same transform to a matching batch of masks, so a mask that marked the subject still marks the subject after the image spins.

Rotating an image is easy. Rotating an image so its corners don't get cut off is where most naive implementations fail: a rectangle rotated by 30° sticks out of its own frame. This node handles that by expanding the canvas - it pads the image onto a larger square (sized to the diagonal, so no corner can escape), rotates, then crops back to that square. You lose no pixels, but the output is bigger and square-ish, not the original footprint.

It's part of the NIX pack - small, dependency-light (numpy + Pillow), no models to download. Install the pack once and this node is just there.

How it works

  • images (required) - the batch to rotate.
  • angle (required, INT, −180 to 180) - degrees. Zero is a pass-through.
  • masks (optional) - a matching batch of MASK. Each mask gets the same rotation, using bilinear sampling (the images use bicubic). If you don't pass masks, or a particular mask is missing, you get a black zero mask in its place - so the output batch shape always matches.
  • flip_horizontal (optional, default off) - mirrors everything left-right, on top of the rotation.

Outputs are images and masks, both batch-aligned, both the same square size.

The one thing to internalize: output dimensions change. A 1024×768 image rotated becomes a ~1280×1280 square. If your downstream nodes expect the original size, that's exactly what NIX_RotateCrop is for - the two are designed as a pair.

When you'd reach for it

  • Data augmentation for training: rotate + flip a dataset without desyncing labels or masks. This is the node's natural habitat - augmented masks stay glued to augmented images.
  • Straightening a tilted photo before an img2img or face pass: rotate by a few degrees, then NIX_RotateCrop to trim back to the frame.
  • Orientation invariance: generate the same image at several rotations to test how the model handles them, or to feed a pose-agnostic pipeline.

For plain 90° steps, core ComfyUI's ImageRotate is simpler and lossless. This node shines at arbitrary angles, especially when masks are involved.

Getting it installed

  • ComfyUI Manager: search "NIX" (or the pack title "NIX ComfyUI Plugin"), or Install Custom Nodes → Git URL → https://github.com/J-ChenX/ComfyUI-NIX. Restart after.
  • By hand:
    cd ComfyUI/custom_nodes
    git clone https://github.com/J-ChenX/ComfyUI-NIX
    
    Restart ComfyUI. No model downloads. It's under the "NIX" category.

Things that will bite you

  • Canvas grows. Expect the output to be a square larger than your input. If that breaks downstream nodes, add NIX_RotateCrop.
  • Mask batch is reconciled silently. If you pass fewer masks than images, the remainder come back as black zeros - check your mask count if things look "missing."
  • Rotation is bicubic on images, bilinear on masks. That's deliberate (hard edges on masks), but it means a rotated mask is slightly softened.
  • Quiet pack. Almost no community footprint for NIX as of mid-2026, so don't expect forum recipes; the source is one readable Python file if you want the exact canvas math.
CategoryNIX

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
angleINT0-180–180
masksoptMASK
flip_horizontaloptBOOLEANfalse

Outputs (2)

NameTypeDescription
imagesIMAGE
masksMASK