Simple Image Rotate
Rotate an image by any angle — and get the gaps as a mask for free
- image
- image
- mask
Core ComfyUI will flip an image and rotate it in 90-degree steps, but "turn this thing 12 degrees" always means hunting through custom node packs. Simple Image Rotate is that node, and it does one extra thing that makes it worth a look: it hands you the empty corner space it just created, as a mask. So rotation doesn't have to be a dead end - you can rotate, take the gap mask, and inpaint the corners in one pass, or composite the rotated image over a background and let the alpha channel blend it.
How it works
Under the hood it's Pillow, not a model. The image is converted to RGBA, rotated with Image.rotate(angle, resample=Image.BICUBIC, expand=True), and sent back out as a tensor. The expand=True is the important part: instead of clipping the corners off a rotated rectangle, the canvas grows to fit the rotated image and the corners become transparent. The second output is the inverse of that transparency - black where the original pixels are, white in the gaps. That's your mask, ready to feed an inpainting pass.
The whole thing is one small class in the pack's single nodes.py. No models, no checkpoints, nothing to download - the pack is just five image utilities, and this is one of them.
The inputs and outputs that matter
Only two inputs, which is the point of the word "simple":
image- the IMAGE to rotate.angle- a FLOAT in degrees. Positive is counter-clockwise, negative is clockwise. The range goes to ±3600 - ten full turns, for reasons the author left unexplained.
Outputs:
image- the rotated image, in RGBA.mask- an IMAGE (not a MASK type - see below) that's white in the gaps created by rotation, black on the original pixels.
The sign convention is the one thing people flip. Positive = counter-clockwise, which matches Pillow but is the wrong way to "fix a tilted photo". Keep a Preview node on it until your muscle memory adjusts.
Installing it
The node ships in the comfyui_my_img_util pack. ComfyUI Manager is the easy road - search for "comfyui_my_img_util" and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/sugarkwork/comfyui_my_img_util
cd comfyui_my_img_util
pip install -r requirements.txt
Then restart ComfyUI. Requirements are numpy, Pillow, and opencv-python - and yes, opencv-python gets installed even though this node never touches it, because the pack's nodes.py imports cv2 at the top. If you clone manually and skip the pip install, the whole pack fails to load, not just the denoise node. The README is in Japanese, which tells you where the author works, and the pack is on the Comfy Registry.
Common issues
rotated.pngandreverse.pngkeep appearing in your ComfyUI folder. That's not you doing something wrong. The node saves both debug images to the current working directory on every run - a leftover from development. Harmless, just messy.- The mask is an IMAGE, not a MASK. Most inpainting nodes want a MASK tensor, so you'll get a type error if you wire this straight into a
Set Latent Noise Mask. Route it through the standardConvert Mask to Image/Image to Maskpair from whatever plumbing pack you already have installed. - RGBA output surprises. The image output carries an alpha channel, and a few downstream nodes quietly assume 3-channel RGB. If something misbehaves after rotation, convert to RGB first.
- It's marked as an output node, so it always executes. Handy when you want to guarantee a rerun; mildly annoying if you've built a chain you're trying to cache.
Where you'd actually use it
Straighten a tilted scan. Build a tilted-frame collage. Rotate a character card a few degrees and inpaint the now-empty corners using the mask it hands you. For animation, nudging frames a degree or two to add camera wobble is deterministic and instant - no diffusion pass needed. The post-processing crowd has a strong position on this: most of this layer should be cheap, deterministic pixel work, not generative re-passes. This node is a textbook example of that principle: instant, free, and does exactly one thing.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| angle | FLOAT | 0.00-3600–3600 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | IMAGE | — |