Rotate Image (Purz)
Spin without losing the corners to black
- image
- image
Rotation sounds like the most boring node imaginable, until you need to straighten a photo and the default tool fills the empty corners with black and calls it a day. PurzImageRotate is the slightly more thoughtful version: it rotates your IMAGE by any angle, expands the canvas so nothing gets clipped, and lets you pick what fills the exposed areas - black, white, or transparent. Small feature, big quality-of-life difference.
It's from ComfyUI-Purz, the utility pack by PurzBeats (a Comfy Org staffer), and it sits in the Purz/Image/Transform category next to the pack's flip node.
How it works
Straight Pillow under the hood: the image is converted, rotated with expand=True (so the canvas grows to fit the rotated image - nothing is cropped away), and the corners are filled with your chosen background_color. Two implementation details worth knowing. First, the rotate is a real interpolation, so a 90° rotation is crisp but a 37° rotation resamples the pixels slightly - one-time quality loss, then it's baked. Second, when you pick transparent, the image is rotated as RGBA with a transparent fill, then composited back onto an RGB black background - so you get the effect of transparency as a proper alpha cutout being flattened, which means the transparent corners come out black when you look at the raw RGB result. If you genuinely need alpha on the output, you'll want to handle that downstream.
The inputs that matter
- image - the
IMAGEto rotate. Batch-safe, so you can straighten a whole frame sequence at once. - angle - −360 to 360 degrees, default 45. Negative rotates counter-clockwise. Since the canvas expands, every angle is valid - no "must be a multiple of 90" constraint.
- background_color -
black,white, ortransparent. This is the one that changes the character of the result. Black is the default and fine for most compositing; white matters if the rotated image is going onto a light background;transparentis for when you want the corners to vanish.
Output is image, an IMAGE that's larger than the input whenever the angle isn't a multiple of 90 - the node grows the canvas rather than clipping, which is the behavior you actually want but should remember when you're checking sizes.
Installing it
ComfyUI Manager - search ComfyUI-Purz - or:
cd ComfyUI/custom_nodes/
git clone https://github.com/purzbeats/ComfyUI-Purz.git
cd ComfyUI-Purz
pip install -r requirements.txt
Restart ComfyUI. Requirements are OpenCV, Pillow, torch, numpy - all standard, no models.
Where people get burned
The biggest surprise is the output size. Rotate a 512×512 image by 45° and you get a ~725×725 image (plus fill), which can silently change the aspect ratio of anything downstream that expects the original dimensions. If you're rotating inside a pipeline that needs a fixed canvas, rotate and then resize back. And as noted, transparent isn't a true alpha-channel output - the corners come out black in the final RGB tensor, so don't assume you've got a PNG with alpha when the workflow is done.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| angle | FLOAT | 45-360–360 | — |
| background_color | COMBO | black | 3 options: black, white, transparent |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |