Nodes/Comfyui_PDuse/PD:Image Rotate
ComfyUI Node

PD:Image Rotate

Rotate an image any angle you like — without losing the corners

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD:Image Rotate
  • images
  • images
mode
rotation90
sampler

ComfyUI's built-in Image Rotate is a 90-degree-affair - rotate 90, 180, 270, done. That's honestly enough for 90% of what you'll ever do. But the other 10% - a scanned sheet that came in at 3 degrees, a photo you want to level, a tilted sticker grid you're about to split up - needs a real arbitrary-angle rotation that doesn't cut your corners off. That's the whole reason PD_Image_Rotate_v1 ("PD:Image Rotate") exists, and it's one of the more genuinely useful nodes in the 7BEII/Comfyui_PDuse pack.

How it works

It's a PIL rotate under the hood, with a rotation input from -360 to 360 degrees (default 90) and three sampler choices - nearest, bilinear, bicubic. Nearest is crisp for pixel art and lineart; bicubic is the smooth default for photos. Bilinear sits in between. The interesting part is the mode dropdown, which has two distinct behaviors:

  • transpose - the "don't lose anything" mode. For angles that aren't a multiple of 90, it computes the minimum bounding rectangle for the rotated image, grows the canvas to fit, rotates, and trims to the rotated content. Nothing gets clipped. For 90° multiples it uses PIL's lossless transpose instead of resampling.
  • internal - rotates inside the original canvas, then auto-crops to the non-transparent bounding box. The output stays near the source dimensions, but content that leaves the frame gets trimmed, and any leftover transparent areas get filled black.

The practical rule: use transpose when the whole image matters (you're leveling a scan), use internal when you want the rotated object cropped back down to something compact. If you pick a non-90 angle in "transpose", the node quietly does the bounding-rect math for you, so you don't have to pre-size a canvas.

The one input that matters

  • images - your IMAGE in; it handles batches, so a whole folder loaded as a batch rotates together.
  • mode - transpose vs internal, above.
  • rotation - the angle. Negative values go the other way.
  • sampler - resampling quality.

The single output is images - same batch count as the input, just spun. That's it, one wire, no surprises.

Installing

ComfyUI Manager: search for Comfyui_PDuse. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt

Restart ComfyUI after. No models to download - the pack's requirements are mostly things ComfyUI already ships (numpy, Pillow, torchvision, opencv-python), plus scipy, xlrd, and openpyxl for its Excel/analysis nodes. Rotation itself only needs Pillow, which you definitely already have.

Gotchas

The README is Chinese, and this pack's node names wander - the class is PD_Image_Rotate_v1 but it displays as "PD:Image Rotate". One real footgun: rotation via PIL resamples, so a non-90-degree rotation of pixel art will soften it - stick to nearest sampling if you're rotating sprites or lineart. And remember "internal" mode can clip corners: if your subject touches the edge of the frame and you don't want it sliced, that's the transpose mode's job.

CategoryPDuse/Image

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBO2 options: transpose, internal
rotationINT90-360–360
samplerCOMBO3 options: nearest, bilinear, bicubic

Outputs (1)

NameTypeDescription
imagesIMAGE