Nodes/zsq_prompt/Image Rotate
ComfyUI Node

Image Rotate

Rotate any angle without losing the corners

By windfancy·Created 2 years ago·Updated 5 months ago· 2
Image Rotate
  • image
  • image
expandtrue
angle0.0
image_outputPreview
save_prefixComfyUI

Image Rotate (imageRotate) from the zsq_prompt pack rotates an image by any angle from -360° to 360°, and it has one checkbox that decides whether the result is useful or secretly cut up: expand. This is the node to reach for when you need a straighten, a tilt, or a full 90° spin and you don't want to fish the corners out of the trash.

How it works

It's a PIL rotate() under the hood, applied to each frame of the batch. The angle input is a slider from -360 to 360 (step 0.1), so you can do exact 90° turns or a jaunty 3.7° tilt. The expand toggle is the star:

  • expand = true (default) - the canvas grows to fit the rotated image, so a 45° rotation of a square becomes a bigger diamond with no content clipped. The output dimensions change to accommodate the rotation.
  • expand = false - the canvas stays the original size, so any corners that rotate out of frame get cut off. This is the "crop to canvas" behavior, and it's what you want for things like a 90° turn where nothing leaves the box.

It's an output node, so it also has the image_output dropdown (Hide / Preview / Save / Hide/Save) and a save_prefix - you can preview or write the result straight to disk from the node itself.

Inputs and outputs that matter

  • image - the IMAGE to rotate.
  • expand - grow the canvas to fit, or clip to the original box. Default true; think before unchecking it.
  • angle - degrees, -360 to 360.
  • image_output / save_prefix - preview/save behavior, same pattern as the pack's other output nodes.
  • Output: image - the rotated tensor.

Where it fits

  • Straightening a slightly tilted render or a scanned reference before feeding it to img2img - a couple of degrees makes a surprising difference to how clean a regenerate comes out.
  • Orientation fixes - 90° or 180° turns for portrait/landscape swaps, or when a batch came out sideways.
  • Creative tilts - Dutch-angle vibes on a subject, then crop back down with the pack's imageCrop (using expand=true so nothing important gets sliced).

Note what this is not: it's not a flip. Left-right or up-down mirroring is a different operation (the pack has imageFlip for that). Rotation turns, flipping mirrors.

Installing zsq_prompt

Shared pack install. ComfyUI Manager → search zsq_prompt → install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/windfancy/zsq_prompt

Restart ComfyUI. The pack drags in a heavy dependency set (transformers, opencv-python, opencv-contrib-python, scikit-image, timm, onnx, ultralytics) even though this node only needs PIL. If Manager flags "conflicting with zsq_prompt" on a workflow, that's dependency-overlap noise - ignore it unless the pack is actually installed. No model downloads needed.

Gotchas

  • With expand = true, the output dimensions change with the angle. Downstream nodes expecting a fixed size will complain - resize or crop after.
  • Rotation interpolates pixels, so it's slightly lossy; rotating 90° (which should be pixel-exact) is the exception, and even then PIL may resample.
  • Angles like 45° on a rectangle produce a big empty-canvas image. If you're going to composite, plan for the bounding box.
CategoryZSQ/Image

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
expandBOOLEANtrue
angleFLOAT0.0-360–360
image_outputCOMBOPreview4 options: Hide, Preview, Save, Hide/Save
save_prefixSTRINGComfyUI

Outputs (1)

NameTypeDescription
imageIMAGE