ComfyUI Node

MediaPipe Face Mesh

Full-face masks in one click, from the cloud

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

Every now and then you need to edit a whole face - relight it, reskin it, fix a bad jawline - without touching the rest of the image. That's a full-face mask, and this node is the fastest way to get one: drop a photo in, and MediaPipe returns the entire face region as a soft-edged mask, computed on Runware's servers.

How it works

Like the other MediaPipe nodes in the pack, this is an imageMasking task. Your image goes up to Runware's cloud, a face-mesh model fits a landmark mesh over every face it can find, and the node hands back the mask as an image output (IMAGE tensor). The rest of the frame comes back as pure black - no background, no hair unless the mesh catches it, just skin.

You then wire that mask into an inpainting pass. Because it's an IMAGE rather than a MASK, run it through the core ImageToMask node if your sampler needs the MASK type, or feed it straight into a Runware inpaint node that accepts IMAGE masks. What you get back is the classic masked-inpainting guarantee: everything outside the mask stays pixel-identical. That's the whole reason mask workflows survive in the age of instruction-based editors.

The controls

Four widgets do the real work:

  • settings.confidence (default 0.5) - detection threshold. Faces being skipped → lower it.
  • settings.maskBlur (default 5) - edge feathering. 5 is a sane default; increase if you see hard seams after inpainting.
  • settings.maskPadding (default 10) - grows or shrinks the mask. Bump it positive if your inpaint is cutting off the chin or hairline.
  • settings.maxDetections (default 6) - cap on faces processed at once.

ttl, ttl_value, and outputFormat are pack-wide plumbing you can ignore. There's no model download involved - the model lives on Runware's side, so this works on a laptop with no GPU.

Install

This node ships in ComfyUI-Runware, so installing the pack gives you all the MediaPipe variants at once:

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). Then set your key: Settings → Runware API key, the RUNWARE_API_KEY env var, or runware auth login.

Gotchas

It's a paid per-run call, and the title bar shows the cost plus a NSFW flag after each inference - handy but easy to miss when you're iterating on a batch. Also worth knowing: the mask is a grayscale image, so any node expecting a MASK socket needs that conversion step. And if a portrait's hair or ears matter to you, note the mesh traces the face, not the hairdo - plan your padding accordingly.

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