Nodes/tri3d-comfyui-nodes/Scaled paste unsafe v5.1.0
ComfyUI Node

Scaled paste unsafe v5.1.0

The same paste, minus the fit-guarantee — and it will crop your subject

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Scaled paste unsafe v5.1.0
  • image_background
  • image_foreground
  • mask_foreground
  • IMAGE
scale_factor1.20
height_factor1.01

This is the sibling of scaled-paste with the safety rails off, and the name is doing honest work: "unsafe" here means it can crop the subject. Where the safe version computes a scale that guarantees the whole foreground fits on the background, this one just scales the background by scale_factor and pastes the foreground where it lands - which, if the subject is taller than the available space, slices the top of it off.

Same inputs, same bottom-center logic, same mask-weighted blend. The difference is entirely in the sizing math, and the _unsafe flavor trades the fit guarantee for a more predictable, faster result. There's a real use case: when you've already sized things upstream, or when you want a tight framing and don't care about a clipped head, the safe node's automatic rescaling just gets in the way.

How it works

The unsafe path does the paste in a more literal way. It scales the background to scale_factor times its size, then computes the paste region as a window into that background: vertically, the foreground starts so that its bottom sits on the background's bottom (minus a height_factor lift), and - here's the "unsafe" part - the foreground is then cropped from a computed start row, so only the portion of the subject that fits in the window survives. Anything above the window is simply not drawn. Horizontally it centers, same as the safe version.

In short: the safe node guarantees containment by growing the background; the unsafe node guarantees the background size and lets the foreground lose its top.

The inputs that matter

Identical to the safe version:

  • image_background, image_foreground, mask_foreground - scene, cutout, and mask.
  • scale_factor (FLOAT, 1–10, default 1.2) - the background scale.
  • height_factor (FLOAT, 1–8, default 1.01) - vertical placement of the subject.

Output: the composited IMAGE.

Installing it

Same pack:

cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
cd tri3d-comfyui-nodes
pip install -r requirements.txt

or ComfyUI Manager → "tri3d-comfyui-nodes", restart, under TRI3D.

Common issues

  • "My subject is missing its head" - that's the feature. The unsafe paste crops the foreground top when it exceeds the window. If the crop is unwanted, raise scale_factor (background gets bigger, more room) or switch to the safe node.
  • height_factor controls the crop - because the paste window is computed from the bottom up, height_factor doesn't just place the subject, it decides how much of it fits. Tune it slowly.
  • Same DEBUG spam - this node also prints debug lines on every run. Ignore them.
  • Same output-size surprise - output dimensions are scale_factor-times the background, so the resolution changes with the slider.

Reach for _unsafe when you've pre-sized your inputs and want deterministic framing. When in doubt, use the safe version - a subject that stays whole beats one that doesn't.

CategoryTRI3D

Inputs (5)

NameTypeDefaultDescription
image_backgroundIMAGE
image_foregroundIMAGE
mask_foregroundMASK
scale_factorFLOAT1.201–10
height_factorFLOAT1.011–8

Outputs (1)

NameTypeDescription
IMAGEIMAGE