Rotate Image
Straightening a tilted face so InsightFace can actually find it
- image
- rotated_image
InsightFace, the face-detection library sitting under this whole pack (and under basically every no-training face tool - InstantID, PuLID, and ReActor all lean on the same ArcFace backbone), is noticeably worse at finding faces that are tilted. A head at 30 degrees, a photo shot sideways - that's exactly the kind of input that produces the pack's most common headache, "No face detected in pose image." Rotate Image is the fix: straighten the face out, run detection reliably, generate, then rotate everything back to where it started.
What it is and why you'd reach for it
This is one node doing one simple thing - rotate an image by a given angle - but it only earns its keep paired with the rest of the pack's rotation toolkit. You don't usually set the angle by hand. Instead, Get Angle from Face (which needs InsightFace and a mask to know where to look) or Get Angle from KPS data (if you already have keypoints) calculates how much rotation is needed to bring the face upright, and this node applies it.
How it works
The node also expands the canvas as it rotates, like a "rotate canvas, don't crop" option - so corners don't get clipped off mid-rotation. That's deliberate, but it means the output is bigger than the input, and you'll want the companion Remove Rotation Padding node afterward to trim the expanded canvas back down once you've rotated the result back to its original orientation. The pack's auto_rotate.json example workflow shows the whole loop end to end: detect the angle, rotate to straighten, run the face swap, rotate back, strip the padding. That loop is the difference between a workflow that only works when the subject happens to be upright already and one that works on whatever photo you throw at it.
Inputs and output
Three inputs, nothing exotic:
image- the image to rotate.angle(default 0, range -360 to 360, 0.1° steps) - usually piped in from Get Angle from Face or Get Angle from KPS data rather than typed by hand, though nothing stops you from entering a value directly.counter_clockwise(boolean, defaulttrue) - which way the rotation goes. This matters more than it looks like it should: the angle nodes calculate a value assuming a specific rotation direction, and if this toggle doesn't match that assumption you rotate the face the wrong way, which makes detection or alignment worse rather than better.
One output - rotated_image - which feeds into whatever's next in your graph, typically Preprocess Image for InstantId or another pass through face detection. Keep the original image available alongside it too, since Remove Rotation Padding needs both the before and after image to know how much to trim.
Installing it
Ships with the rest of the pack, no separate install step. ComfyUI Manager: search comfyui-instantId-faceswap, install, restart. By hand: cd ComfyUI/custom_nodes && git clone https://github.com/nosiu/comfyui-instantId-faceswap, then pip install -r requirements.txt in that folder, then restart. Rotate Image itself needs no models - it's pure image math - but you'll almost always pair it with Get Angle from Face, which does need InsightFace's antelopev2 models placed by hand under ComfyUI/models/insightface/models/antelopev2 (fetched from Hugging Face, not auto-downloaded). Worth knowing before you lean on this pipeline for anything commercial: those antelopev2 weights are non-commercial research models, the same restriction every InstantID-based tool inherits.
Where people get burned
The pack's own docs are honest about the real limitation: at extreme rotation angles, InsightFace's landmark detection can lose track of the face's true position, so the angle Get Angle from Face hands to this node isn't always right in the first place - garbage in, garbage out. When that happens, the suggested fallback is to skip automatic angle detection entirely and draw your own KPS by hand with the Draw KPS node, which shows you the correct rotation angle live as you place the points. The other common trip-up is forgetting Remove Rotation Padding afterward - the expanded canvas from this node sticks around and throws off any compositing you do downstream if you don't strip it back to the original dimensions first.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| angle | FLOAT | 0.0-360–360 | — |
| counter_clockwise | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| rotated_image | IMAGE | — |