Nodes/WtlNodes/Mask Rotation
ComfyUI Node

Mask Rotation

Rotate a mask — and actually see what you're doing first

By Scorpiosis0·Created 10 months ago·Updated 2 months ago· 3
Mask Rotation
  • mask
  • MASK
rotate0
interpolationnearest
fit_mode
enhanced_visibilityfalse
apply_type

ComfyUI's stock image transform nodes are fine, but there's a whole class of workflows that need the same transforms applied to a mask - and stock ComfyUI is weirdly thin there. MaskRotation is the WtlNodes answer: rotate a mask by any angle and get a MASK back, with four different behaviors for what happens to the edges.

The rotate input takes −360 to 360 degrees. The more interesting control is fit_mode, which decides how the rotated result is framed:

  • crop - rotate in place, cut off whatever spills outside the original bounds.
  • fit - scale the rotated mask down so all of it fits inside the frame.
  • adjust - expand the canvas to contain the rotated mask (so output size changes).
  • none - straight rotation, no fitting at all.

And interpolation gives you the standard five: area, nearest, bilinear, bicubic, lanczos. For masks, nearest is the safe default (it keeps hard edges hard, which is usually what you want from a mask); bicubic or lanczos smooth the edges slightly if you're rotating something feathered. Under the hood it's OpenCV's warpAffine, the same transform engine as the image rotation nodes.

The signature feature is enhanced_visibility plus the live preview. When you enable it, the preview renders the "empty" region as red against the rotated mask - because a white mask on a black background is genuinely hard to read at a glance, and this makes rotation errors obvious. One honest caveat: that red background is preview-only. The actual MASK output is the plain grayscale mask, so don't expect a red-tinted result downstream.

The apply_type dropdown is the pack-wide interactive preview system: none pauses per image and waits for Apply/Skip while sliders update live, apply_all pauses once for the whole batch, auto_apply just runs. If you're running headless or via API, auto_apply only - the interactive modes block until someone clicks a button in the browser.

Install via ComfyUI Manager (search "WtlNodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/Scorpiosis0/ComfyUI-WtlNodes.git

then restart ComfyUI. Deps are numpy, scipy, pillow, with OpenCV doing the actual rotation from your standard ComfyUI environment. No models to fetch.

Rotating a mask is niche until you're doing composition work - rotating a face region to match a reference, rotating an inpaint mask for a tilted object, aligning masks between passes - and then it's exactly what you need and stock ComfyUI doesn't really give it to you in one place.

CategoryWtlNodes/mask

Inputs (6)

NameTypeDefaultDescription
maskMASK
rotateFLOAT0-360–360
interpolationCOMBOnearest5 options: area, nearest, bilinear, bicubic, lanczos
fit_modeCOMBO4 options: crop, fit, adjust, none
enhanced_visibilityBOOLEANfalse
apply_typeCOMBO3 options: none, auto_apply, apply_all

Outputs (1)

NameTypeDescription
MASKMASK