Nodes/tri3d-comfyui-nodes/Skip Lip Mask v5.1.0
ComfyUI Node

Skip Lip Mask v5.1.0

Erase everything above the lips in one pass

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Skip Lip Mask v5.1.0
  • image
  • IMAGE
keypoints_json

Another one of those TRI3D nodes where the name points backward. Skip Lip Mask doesn't touch a lip mask at all - it finds where your lips are and blackens every pixel above them. Eyes, nose, forehead, most of the mouth: gone. What survives is the chin and everything below. If your pipeline wants to regenerate the upper face while keeping the lower one (or the other way around), this is a two-input shortcut.

It ships in tri3d-comfyui-nodes (TRI3D-LC, v5.1.0), and like most of the pack's face nodes it's pose-driven rather than model-driven - pure OpenCV over a DWPose keypoint file.

How it works

The node takes image and a keypoints_json path, reads the flattened keypoints, and pulls out the lip landmarks. The pack's keypoint format is the 130-point OpenPose layout (18 body + 70 face + hands), and the lip region lives around flat indices 61–68. It takes the lowest of those lip points, then does the signature move:

result_image[:lowest_lip_y, :] = 0

Everything above the bottom lip gets zeroed. Below it is untouched. So a portrait comes out as a black slab with the chin, jaw and neck still visible - exactly the split you want before an inpaint pass that redraws the face.

There's a fallback if no valid lip keypoints exist (bad pose, side profile, occluded face): it estimates the lip line from the nose point plus 15% of image height, or a third of the height if even that fails. So the node degrades gracefully instead of crashing - but the blackout line will be wrong, and you'll see it.

The inputs

  • image - the photo/portrait.
  • keypoints_json - STRING with the file path to the keypoint JSON ({"height", "width", "keypoints": [[x,y],...]}). Produce it with the pack's tri3d_SaveFlattenedPoseKpsAsJsonFile node wired to a DWPose detector, or write it yourself in the same format.

Output is one IMAGE with the upper face blacked out.

Install

ComfyUI Manager → search tri3d-comfyui-nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes

Restart ComfyUI. Nothing extra to download - cv2 and numpy are already in ComfyUI.

Gotchas

The lip indices (61–68) are an assumption baked into the code, written to match OpenPose/DWPose ordering - so feed it keypoints from the pack's own SaveFlattened node and you're fine, but a JSON from a different keypoint convention will give you a garbage cutoff. Watch the fallback behavior too: if DWPose missed the face, you won't get an error, you'll get a black line drawn in the wrong place. And as with the other Skip nodes, only the first frame of a batch is processed. It's a one-trick node, but the trick is cheap and the math is transparent.

CategoryTRI3D

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
keypoints_jsonSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE