MediaPipe Lips Mesh
A lips-only mask, without drawing a single pixel
- image
- image
Changing someone's lipstick, fixing wonky teeth, or reworking a mouth that came out of the sampler looking off - every one of those starts with a lips-only mask, and drawing one by hand on a face is fiddly at best. This node hands you the mask for free: MediaPipe traces the lips on the cloud and returns a clean, feathered mask of just that region.
How it works
It's an imageMasking node in the Runware pack. Your image is sent up, a face-mesh model fits the mouth landmarks, and you get back the lips as an image output - an IMAGE tensor of the mask, black everywhere except the mouth area. The heavy lifting is server-side, which is the pack's whole deal: no local model, no GPU, no weights file to babysit.
Then it's the standard mask → inpaint pattern. Convert the IMAGE mask to MASK with core ImageToMask if your inpaint node wants that type, or feed it into a Runware inpaint node that accepts IMAGE masks directly. Because the edit is pinned to the mask, the teeth/lipstick change stays local and the surrounding skin is untouched - the bit-identical-unmasked-pixels guarantee that masked inpainting still owns.
The settings you'll touch
Four widgets, same as the rest of the MediaPipe family:
settings.confidence(default 0.5) - detection threshold. Mouths being missed → lower it.settings.maskBlur(default 5) - feather on mask edges. Lips sit right next to skin, so a little blur is your friend; keep seams from showing by leaving this near default.settings.maskPadding(default 10) - extend or shrink the region. Positive padding bleeds into the philtrum and chin if you're careless; for lipstick changes you often want to shrink a touch.settings.maxDetections(default 6) - faces to process in a batch.
ttl / ttl_value and outputFormat are shared pack plumbing - ignore them.
Install
One pack, all the MediaPipe masks:
cd ComfyUI/custom_nodes
git clone https://github.com/Runware/ComfyUI-Runware
pip install -r ComfyUI-Runware/requirements.txt
Restart ComfyUI, or use ComfyUI Manager → search "Runware" → install. Dependencies are light (runware-sdk, pillow, soundfile); the only thing you need besides that is a Runware API key from the dashboard - paste it in Settings → Runware API key, set RUNWARE_API_KEY, or runware auth login.
Gotchas
It's pay-per-run and network-bound; the title bar shows the cost and a NSFW flag after each call. And a heads-up for the obvious use case: since the mask comes back as a grayscale image, don't try to plug it straight into a MASK socket - convert first. Half the "this node is broken" reports in cloud-mask workflows are that one missed step.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| settings.confidenceopt | FLOAT | 0.500–1 | Confidence threshold for detections. Only detections above this score are included. |
| settings.maskBluropt | INT | 50–100 | Blur radius for mask edges, creating smooth transitions. |
| settings.maskPaddingopt | INT | 100–200 | Pixel amount to extend (positive) or shrink (negative) the mask area. |
| settings.maxDetectionsopt | INT | 61–20 | Maximum number of detections. Prioritizes highest confidence scores if exceeded. |
| ttlopt | BOOLEAN | false | Enable to set ttl. Off uses the model's default. |
| ttl_valueopt | INT | 60 | Time-to-live (TTL) in seconds for generated content. Only applies when `outputType` is `URL`. |
| outputFormatopt | COMBO | JPG | File format for the generated image. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |