Prompt Studio Estimate Pose Mask
Two Skeletons In, One Rough Mask Out
- preview
- mask
Re-posing someone is easy to ask for and annoying to execute: the old body has to be erased, the new one drawn, and everything around both preserved. This node gives you a head start by drawing a mask that covers both bodies - the pose you started with and the pose you're moving to - so you can review and paint over it instead of starting from a blank canvas.
What it is
PS_EstimatePoseMask takes two sets of OpenPose joints and returns a preview IMAGE and a mask MASK. It's the estimator behind Prompt Studio's "Edit background mask" flow: when you ask to preserve the background on a pose edit and no matching saved mask exists, the Studio queues this node to produce a first draft. In the pack's own words, the estimate is "reviewable" - the whole point is that you look at it and fix it, because it estimates anatomy, not a silhouette.
In a graph, its mask output is what you feed to Structure Input's edit_mask input when you're wiring pose preservation by hand. White regenerates, black preserves.
How it works
The mask is drawn from joints, which explains both its strengths and its failure modes. Per person, the estimator:
- derives a body scale from the distances between shoulders, hips and neck (
distance(2,5),distance(8,11) × 1.3, hips-to-neck at 0.65), taking a median as the working scale; - fills the torso as a polygon between shoulders and hips, and lays capsule segments along the arms, legs and neck with radii proportional to that scale;
- draws an enlarged ellipse for the head (it flattens the head centre slightly, which is how it grabs hair volume), plus finger capsules from hand keypoints and small ellipses for feet;
- adds your
padding- a percentage of body scale - around all of it.
Then it does the part that actually makes it useful. The source mask is rendered at source_width × source_height; the target mask is mapped through the exact same framing, crop and placement code the pose guide uses, using guide_width, guide_height and fit, so the target body lands where the generation will actually put it. The two are unioned, and the union gets a Gaussian blur scaled to the image dimension so the edge is soft rather than a hard cut. That soft edge flows through to the weighted composite later.
It's opinionated about bad input, too: more than one person in either pose stops it unless all_people is true, and too few valid joints is an explicit refusal rather than a bad mask. It won't guess which body you meant.
The inputs that matter
source_pose_json/target_pose_json- OpenPose pose JSON. The source must describe the full original image, not a donor photo: the mask canvas is built from it.source_width/source_height- the mask's output resolution, i.e. your source image's real size.guide_width/guide_height,fit(fitorcrop) and the optionaltargeting- these must match how your pose guide is framed, or the target body lands in the wrong place. The bundled workflows pass the same values into Structure Input.padding(default 10, 0–100, as a percentage of body scale) andall_people.
preview is worth wiring to Preview Image on a first run; mask goes into the inpainting path.
Install
Ships with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/tiko13/ComfyUI_PromptStudio
Restart ComfyUI. No pip dependencies and no model download for the estimator itself - but the joints come from DWPose via Fannovel16's ControlNet Auxiliary Preprocessors pack, which the setup wizard installs. Qwen weights need the Qwen Research License accepted.
Common issues
- "Too few body joints for a reliable estimate. Draw the mask manually." The joints are bad: transparent or missing keypoints, a crop that cut the person in half, or a skeleton from a different image. This is the node refusing to draw nonsense.
- "Several people were detected. Draw the mask manually, or explicitly choose Whole guide." Tick
all_peopleif everyone in the frame really is being re-posed; otherwise paint it yourself. - The mask misses half the new pose. Tight masking is the classic mistake - a mask hugging the old outline clips the arm that's reaching out in the new pose. Raise
padding, or paint the extension yourself in the Studio's brush editor. Hair, loose clothing, carried objects and shadows are exactly where the estimation is weakest and where review earns its keep. - The target body is offset. Your
guide_width/guide_height/fit/targetingdon't match the guide's setting. They're the same geometry, so they have to be the same numbers. - The mask looks stale after you changed the target pose. Re-estimate; Undo restores the previous painting.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| source_pose_json | STRING | — | |
| target_pose_json | STRING | — | |
| source_width | INT | 10241–8192 | — |
| source_height | INT | 10241–8192 | — |
| guide_width | INT | 10241–8192 | — |
| guide_height | INT | 10241–8192 | — |
| fit | COMBO | 2 options: fit, crop | |
| padding | FLOAT | 100–100 | — |
| all_people | BOOLEAN | false | — |
| targetingopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| preview | IMAGE | — |
| mask | MASK | — |