Nodes/NIX ComfyUI Plugin/NIX_RotateCrop
ComfyUI Node

NIX_RotateCrop

After a rotation balloons the canvas, this center-crops back to the original size

By J-ChenX·Created 11 months ago·Updated 11 months ago· 2
NIX_RotateCrop
  • rotate_image
  • original_image
  • IMAGE

NIX_RotateCrop is a two-input node that does one thing: take a rotated image and center-crop it back to the same dimensions as the original. It exists because rotation and rectangles don't get along - rotate a rectangular image any amount and you need a bigger canvas to hold it, or the corners get chopped. NIX_RotateImage solves that by expanding the canvas (it pads onto a square sized to the diagonal), which leaves you with a bigger, square-ish image. This node is the cleanup step: trim the excess back down.

It's the second half of a pair. NIX_RotateImage rotates and grows; NIX_RotateCrop trims back. Together they're "rotate without losing corners and without changing your output size," which is exactly the behavior you want for data augmentation - flip and rotate a training set without changing the canvas your pipeline expects.

How it works

Inputs: rotate_image (the rotated, canvas-expanded image) and original_image (the unrotated source, used purely for its dimensions). The node computes the difference in width and height between the two, divides by two, and slices the center original_width × original_height out of the rotated image.

x = (rotated_width - original_width) / 2
y = (rotated_height - original_height) / 2
result = rotate_image[:, y:y+original_height, x:x+original_width]

That's the whole mechanism. It's symmetric and dumb in the good way - it assumes the rotated image is bigger than the original and centered, which is true if it came from NIX_RotateImage, and possibly false otherwise.

The output is a single IMAGE at the original's dimensions.

When you'd use it

  • Data augmentation: rotate + flip a batch with NIX_RotateImage, then NIX_RotateCrop to bring it back to training-ready dimensions.
  • Clean-up after a correction rotation - you tilted a photo straight with NIX_RotateImage, and now you want the frame back to its original footprint without manually computing crop offsets.
  • Pipeline normalization: any time a rotate step changes canvas size and you need a predictable resolution downstream.

Honestly, if you're only doing a 90° rotation, core ComfyUI's ImageRotate handles it losslessly without any of this. NIX_RotateCrop earns its keep for arbitrary angles, where the "bigger canvas" behavior is unavoidable.

Getting it installed

Same pack as every NIX node - one install, no models:

  • ComfyUI Manager: search "NIX" (or "NIX ComfyUI Plugin"), or use 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. Under the "NIX" category; dependencies are just numpy and Pillow.

Gotchas

  • Assumes the rotated image is bigger. If you feed it an image that's smaller than the original, the crop math goes negative and you get garbage. Use it with NIX_RotateImage's output.
  • Original is only for dimensions. The actual pixels of original_image are ignored - it's a measuring stick.
  • It trims, it doesn't re-rotate. After a 180° rotation the crop is upside down; this node just crops.
  • Quiet pack. No real community footprint for NIX as of mid-2026, so there's no crowd-sourced workflow to copy. The source is a single short file - if you've ever wondered what a node does, this one's the easiest to read in the whole pack.
CategoryNIX

Inputs (2)

NameTypeDefaultDescription
rotate_imageIMAGE
original_imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE