Nodes/Mickmumpitz-Nodes/OpenPose Part Mask
ComfyUI Node

OpenPose Part Mask

A rectangular mask around any pose region, no drawing required

By mickmumpitz·Created 8 months ago·Updated 17 days ago· 48
OpenPose Part Mask
  • image
  • pose_keypoint
  • mask
  • x
  • y
  • width
  • height
regionright_hand
person_index0
padding1.30
make_squarefalse
min_size64
mask_blur0
mirror_left_rightfalse
confidence0.05
person_orderdetection
keypoint_indices

Sometimes you don't want the full crop-and-stitch detailer loop - you just want a mask around a body part, to feed into an inpaint node or a crop-stitch utility you already own. That's this node's entire job, and it's the smaller, more composable sibling of OpenPose Part Crop: same pose-keypoint detection, but the output is a plain rectangular mask plus its bounding box.

What it does

Give it an image and a POSE_KEYPOINT (from a live pose detector or this pack's OpenPoseImageToKeypoints), pick a region, and it builds a rectangle around that region's keypoints. The box is clamped to the image, padded, optionally forced square, and emitted as a mask. You can also override the named region with raw BODY_18 indices via keypoint_indices (e.g. 5-7 for the left arm), same as the Crop node.

Inputs worth knowing

  • region - head, face, hands, feet, arms, legs. Remember left/right are anatomical: "right_hand" usually appears on the left of your image; mirror_left_right flips that.
  • padding (default 1.3) - expands the box around the region; 1.0 is tight. Inpainting wants a little breathing room so the fill has context.
  • make_square - force the box square (useful for detailers and for models that want square crops). Off by default here; the Crop node defaults it on, which tells you something about the intended use of each.
  • min_size (default 64), mask_blur (default 0) - floor on box size, and optional edge feathering.
  • person_index / person_order - pick which person; use "left_right" order for a stable two-character setup.
  • confidence (default 0.05) - how confident a keypoint must be to count.

Outputs

mask plus the raw geometry - x, y, width, height - so you can wire the box into anything that wants a bbox rather than a mask. That's four extra outputs you don't get from most mask nodes, and they make this drop-in for crops, ControlNet region wiring, or even just logging the region.

How to use it

The canonical flow, straight from the node's own description: feed the mask into InpaintCropAndStitch (the crop-edit-stitch utility that became the standard way to fix a region without touching the rest of the image) or into any inpaint/detailer node. Compared to OpenPose Part Crop, this hands you the mask and lets you supply your own crop-and-stitch machinery, so you're not locked into the pack's stitch format. If one detection is off, the box falls back to whole-image rather than failing the graph, and the console prints what it found.

Install

Part of Mickmumpitz-Nodes (MIT, deps: numpy, Pillow, opencv-python - no models). ComfyUI Manager, search "Mickmumpitz", or:

cd ComfyUI/custom_nodes && git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes.git

Restart, find it as "OpenPose Part Mask" under Mickmumpitz/OpenPosePartCropper.

CategoryMickmumpitz/OpenPosePartCropper

Inputs (12)

NameTypeDefaultDescription
imageIMAGE
pose_keypointPOSE_KEYPOINT
regionCOMBOright_handLeft/right are anatomical (the subject's own side). 'right_hand' is the person's right hand, which usually appears on the LEFT of the image. Enable mirror_left_right if you prefer image-space sides.
person_indexoptINT00–64
paddingoptFLOAT1.301–4Expand the box around the region (1.0 = tight).
make_squareoptBOOLEANfalse
min_sizeoptINT648–4096
mask_bluroptINT00–256Feather the mask edges.
mirror_left_rightoptBOOLEANfalseLeft/right are anatomical (the subject's own side). 'right_hand' is the person's right hand, which usually appears on the LEFT of the image. Enable mirror_left_right if you prefer image-space sides.
confidenceoptFLOAT0.050–1
person_orderoptCOMBOdetectionHow person_index is ordered when there are multiple characters. 'detection' = the detector's raw order (unstable between frames). 'left_right' = index 0 is the leftmost character, 1 the next, etc. Use left_right for a stable 2-character setup.
keypoint_indicesoptSTRINGCrop a box enclosing these BODY keypoint numbers instead of the named region. Leave empty to use 'region'. Examples: '4' | '2,3,4' | '2-4'. BODY_18: 0 nose, 1 neck, 2 R-shoulder, 3 R-elbow, 4 R-wrist, 5 L-shoulder, 6 L-elbow, 7 L-wrist, 8 R-hip, 9 R-knee, 10 R-ankle, 11 L-hip, 12 L-knee, 13 L-ankle, 14 R-eye, 15 L-eye, 16 R-ear, 17 L-ear. (R/L are the subject's anatomical sides.)

Outputs (5)

NameTypeDescription
maskMASK
xINT
yINT
widthINT
heightINT