Nodes/comfyui_face_parsing/ImageResizeCalculator(FaceParsing)
ComfyUI Node

ImageResizeCalculator(FaceParsing)

Work out the right resize numbers before you resize anything

By Ryuukeisyou·Created 3 years ago·Updated about a year ago· 193
ImageResizeCalculator(FaceParsing)
  • image
  • width
  • height
  • width_old
  • height_old
  • min
  • scale
  • scale_r
target_size512
force_8xtrue
force_64xfalse

This node doesn't resize anything itself - it does the math for a resize, and hands you back a pile of numbers other nodes can use. That distinction matters: plenty of models (and this pack's own BBoxResize) need to know the old and new dimensions of an image, or a clean scale factor, and getting those numbers by hand is fiddly the moment you add constraints like "must be divisible by 8." This node works that out for you once, so every downstream node that needs a dimension or a scale factor can just wire from here instead of you typing numbers in six places.

The inputs that matter

  • image (IMAGE) - required, the image you're computing a resize for.
  • target_size (INT, default 512, min 1) - the size you're aiming for, applied to the image's smaller dimension (see min in the outputs below).
  • force_8x (BOOLEAN, default true) - rounds the computed dimensions to the nearest multiple of 8. This matters because a lot of models (diffusion models especially) require dimensions divisible by 8, so this is on by default for good reason - leave it on unless you specifically know your downstream step doesn't care.
  • force_64x (BOOLEAN, default false) - same idea, but rounds to multiples of 64, a stricter requirement some models impose. Off by default since it's a less common need than 8x alignment; turn it on only if whatever you're feeding this into actually requires it.

The outputs that matter

Seven outputs, all useful in different spots:

  • width / height - the computed target dimensions, after applying target_size and whichever alignment constraint you enabled.
  • width_old / height_old - the source image's original dimensions, passed straight through. These plug directly into BBoxResize's width_old/height_old inputs - a common combo, since if you resize an image you almost always need to rescale any boxes detected on the original to match.
  • min - the smaller of the original width/height, which is what target_size is measured against.
  • scale / scale_r - the computed scale factor and its reciprocal, handy for any node further downstream that wants a multiplier rather than absolute pixel dimensions.

Where it fits

The natural pairing is with BBoxResize: run this node once on your source image to get consistent target dimensions, feed width/height/width_old/height_old straight into BBoxResize so any boxes you detected earlier stay valid after the resize, and use scale/scale_r anywhere else in the graph that wants a ratio instead of raw pixels.

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 or extra dependencies.

Common issues

The thing people miss is that this node computes numbers but performs no resize - if your image looks unchanged after wiring this in, that's expected; you still need an actual image-resize node downstream fed by these outputs. Also worth knowing: target_size targets the smaller dimension (via min), not width or height specifically, so on a non-square image the larger dimension will end up bigger than target_size once the aspect ratio is preserved - that's by design, not a bug, and it's the standard way to say "make the short side at least this big" without distorting the image.

Categoryface_parsing

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
target_sizeINT512
force_8xBOOLEANtrue
force_64xBOOLEANfalse

Outputs (7)

NameTypeDescription
widthINT
heightINT
width_oldINT
height_oldINT
minINT
scaleFLOAT
scale_rFLOAT