ComfyUI Node

KpsScaleBy

Zooming keypoints by a factor instead of a target size

By nosiu·Created 3 years ago·Updated about a year ago· 264
KpsScaleBy
  • kps_data
  • kps_data
scale1.00

The relative sibling to KpsScale. Instead of telling the node "resize to fit this exact canvas," you give it a multiplier - a scale factor - and it grows or shrinks the keypoint set by that amount around its own center. Useful any time you're thinking in terms of "a bit bigger" or "half the size" rather than a specific target resolution.

KpsScale vs KpsScaleBy, plainly

Both rescale kps_data. KpsScale targets an absolute destination width and height - you're aiming for a specific canvas. KpsScaleBy targets a multiplier applied to whatever size the keypoints already are - scale at 1 leaves them unchanged, 2 doubles them, 0.5 halves them. If you already know your target resolution (matching a resize step elsewhere), reach for KpsScale. If you just want the face bigger or smaller by some proportion - say, nudging likeness by shrinking the face slightly relative to the frame, a real technique people use when a face is coming out too dominant - this is the more direct tool.

The inputs and outputs that matter

  • kps_data - required, from any upstream KPS source.
  • scale (default 1, range 0–100) - the multiplier. 1 is a no-op; values above 1 grow the keypoint set, values between 0 and 1 shrink it. The upper bound of 100 is generous enough that you're never going to hit it in normal use - anything past a modest multiplier will push keypoints well off any reasonable canvas.

Output: kps_data, scaled.

Install

ComfyUI Manager: search comfyui-instantId-faceswap. Manual: git clone https://github.com/nosiu/comfyui-instantId-faceswap into custom_nodes/, pip install -r requirements.txt. No model dependency - this is straightforward coordinate math, nothing to download for this node specifically.

Common issues & troubleshooting

Face ends up too small or too large relative to the frame after generation. That's this node doing exactly what it's told - a scale well above or below 1 moves the keypoint bounding area a lot relative to the rest of the canvas. Nudge it in small increments (0.9, 1.1) rather than large jumps unless you specifically want a dramatic change in how much of the frame the face occupies.

Keypoints drift outside the canvas at higher scale values. Because scaling happens around the KPS set's own center, a large enough scale will push the outer points past the edges of whatever canvas you're rendering against. If that happens, either lower scale or make sure your canvas size (in KpsMaker's downstream render, or the pose image itself) is large enough to accommodate the scaled result.

Combined with Kps2dRandomizer's own scale_min/scale_max. These are separate mechanisms - the randomizer's scale range applies its own random multiplier on top of whatever this node already did, if you chain them. That's a legitimate way to add controlled randomness on top of a deliberate baseline scale, but it's easy to lose track of the compounding effect if you're not watching both nodes' values together.

CategoryInstantId Faceswap

Inputs (2)

NameTypeDefaultDescription
kps_dataKPS_DATA
scaleFLOAT1.000–100

Outputs (1)

NameTypeDescription
kps_dataKPS_DATA