Nodes/comfyui_face_parsing/BBoxResize(FaceParsing)
ComfyUI Node

BBoxResize(FaceParsing)

Keep a bounding box valid after you resize the image

By Ryuukeisyou·Created 3 years ago·Updated about a year ago· 193
BBoxResize(FaceParsing)
  • bbox
  • BBOX
width_old
height_old
width
height

A bounding box is just four numbers describing a rectangle in a specific image's coordinate space. Resize that image and those numbers stop meaning anything - a box that used to sit around a face at 1024×1024 points somewhere else entirely once you've scaled to 512×512. BBoxResize exists to fix exactly that: it rescales a box's coordinates to match a new image size, so detection and resizing don't have to happen in a fixed order.

The inputs that matter

All five required, and this is a math node - no defaults, you supply every value:

  • bbox (BBOX) - the box you're rescaling.
  • width_old / height_old (INT) - the dimensions of the image the box was originally detected against.
  • width / height (INT) - the dimensions you're rescaling the box to match.

The output is a single BBOX, rescaled proportionally - if your image shrank to half its width, the box's x-coordinates and width shrink by the same factor, and same for height.

Why you'd need this

The common case: you detect a face on a full-resolution image, but you actually want to run some other step on a downscaled or upscaled version of that same image - maybe you're feeding a resized copy into a different model, or you scaled the image earlier in the pipeline and only now got around to detecting faces on the scaled version while the box needs to apply somewhere else. ImageResizeCalculator is the natural upstream partner here - it works out target dimensions and scale factors for you, which is exactly the width/height/width_old/height_old information this node needs.

Installing it

Comes with the whole pack:

  • ComfyUI Manager - search "comfyui_face_parsing", install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Ryuukeisyou/comfyui_face_parsing.git, restart ComfyUI.

Pure arithmetic - no models, no dependencies beyond the pack itself.

Common issues

The whole node is only as correct as the four dimension values you feed it, and there's no validation catching a mismatch - if width_old/height_old don't actually match the image the box came from, you'll get a box that's confidently wrong rather than an error. If a resized crop looks off-center or clips the face after passing through this node, double-check those four numbers are pulled from the actual images in play, not hardcoded or left over from an earlier version of the graph. Wiring ImageResizeCalculator's outputs directly into this node's inputs, rather than typing dimensions by hand, is the safer pattern.

Categoryface_parsing

Inputs (5)

NameTypeDefaultDescription
bboxBBOX
width_oldINT
height_oldINT
widthINT
heightINT

Outputs (1)

NameTypeDescription
BBOXBBOX