ComfyUI Node

MediaPipe Lips Mesh

A lips-only mask, without drawing a single pixel

By Runware·Created 2 years ago·Updated about a month ago· 140
MediaPipe Lips Mesh
  • image
  • image
settings.confidence0.50
settings.maskBlur5
settings.maskPadding10
settings.maxDetections6
ttlfalse
ttl_value60
outputFormatJPG

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.

CategoryRunware/Image/runware

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
settings.confidenceoptFLOAT0.500–1Confidence threshold for detections. Only detections above this score are included.
settings.maskBluroptINT50–100Blur radius for mask edges, creating smooth transitions.
settings.maskPaddingoptINT100–200Pixel amount to extend (positive) or shrink (negative) the mask area.
settings.maxDetectionsoptINT61–20Maximum number of detections. Prioritizes highest confidence scores if exceeded.
ttloptBOOLEANfalseEnable to set ttl. Off uses the model's default.
ttl_valueoptINT60Time-to-live (TTL) in seconds for generated content. Only applies when `outputType` is `URL`.
outputFormatoptCOMBOJPGFile format for the generated image.

Outputs (1)

NameTypeDescription
imageIMAGE