Skip to content
Node packVerifiedExternal
Open source

masquerade-nodes-comfyui

A powerful set of mask-related nodes for ComfyUI

Maintainer@BadCafeCodeCgrade

Package profile

Status
Verified
Publisher
@BadCafeCode
Source
GitHub
Stars
479
Linked pipes
1

README

Recommended Alternatives

This node pack was created as a dependency-free library before the ComfyUI Manager made installing dependencies easy for end-users.

Unless you specifically need a library without dependencies, I recommend using Impact Pack instead. It's a more feature-rich and well-maintained alternative for dealing with masks and segmentation.

Masquerade Nodes

This is a node pack for ComfyUI, primarily dealing with masks. Some example workflows this pack enables are:

(Note that all examples use the default 1.5 and 1.5-inpainting models. Results are generally better with fine-tuned models.)

  1. Fine control over composition via automatic photobashing (see examples/composition-by-photobashing.json) CompositionExample
  2. Inpaint all faces at a higher resolution (see examples/inpaint-faces.json) FaceInpaintingExample
  3. Inpaint all buildings with a particular LORA (see examples/inpaint-with-lora.json) LoRAInpaintingExample
  4. Filtering out images/change save location of images that contain certain objects/concepts without the side-effects caused by placing those concepts in a negative prompt (see examples/filter-by-season.json) FilterImagesExample

The lynchpin of these workflows is the Mask by Text node. This node makes use of ClipSeg to dynamically create masks from images via text prompts.

Node Descriptions

Mask By Text

Inputs

  • image - The image to use to calculate the mask for.
  • prompt - One or more prompts to select, separated by the | symbol.
  • negative_prompt - Zero or more prompts to select, separated by the | symbol.
  • precision - How sure to be about the mask created.
  • normalize - Whether results should be normalized across the image.
    • Note - This can be useful if you know for certain that your prompt exists in the image, but the model inconsistently recognizes it. I would generally recommend trying with normalize turned off first.

Outputs

  1. Thresholded Mask - The calculated mask after taking precision and normalization into account.
  2. Raw ClipSeg Results - The raw results from ClipSeg. Values are between 0.0 and 1.0.

Tips

  • Using multiple prompts/negative prompts within one node is an ease-of-use and runtime optimization feature. The same result can be achieved with multiple Mask by Text nodes by using Combine Masks -> Union and Combine Masks -> Difference.
  • You can use the raw ClipSeg results for more complex operations (like comparing the relative likelihood of two concepts).

Mask Morphology

Inputs

  • image - The mask to perform the operation on.
  • distance - The distance across which to perform the operation.
  • op - The operation to perform.
    • dilate - Expand the size of the mask.
    • erode - Contract the size of the mask.
    • open - Erode and then dilate. Useful to remove white specs in the mask.
    • close - Dilate and then erode. Useful to remove black specs in the mask.

Outputs

  1. The resultant mask.

Tips

  • Open is useful to remove white specs in a mask. You should generally use it before a Separate Mask Components node.
  • Close is useful to remove black specs in a mask.

Combine Masks

Inputs

  • image1 - The first mask to use.
  • image2 - The second mask to use.
  • op - The operation to perform.
    • union (max) - The maximum value between the two masks.
    • intersection (min) - The minimum, value between the two masks.
    • difference - The pixels that are white in the fir

Nodes in this pack

22 nodes
  • Blur
  • Change Channel Count
  • Combine Masks
  • Constant Mask
  • Convert Color Space
  • Create QR Code
  • Create Rect Mask
  • Cut By Mask
  • Get Image Size
  • Image To Mask
  • Make Image Batch
  • Mask By Text
  • Mask Morphology
  • Mask To Region
  • MasqueradeIncrementer
  • Mix Color By Mask
  • Mix Images By Mask
  • Paste By Mask
  • Prune By Mask
  • Separate Mask Components
  • Unary Image Op
  • Unary Mask Op

Related resources

34 connections
Used byWan 2.2 VACE Video Inpaint: MatAnyone Painted Masking (INT8 ConvRot)Used byWan Vace 2.1 Flow Archive — simpleUsed byTrue 8K Ultra-HD Z-image Text-to-Image Generation (3 minutes 40 seconds) — v1.0Used byFlux Klein Pose & Background Thief (The Ultimate Persona Transfer) — v1.0Used byIllustrious/ Pony/ SDXL SFW & NSFW Pro Grade Workflow (Low and high VRAM) — v11.1.1 Detailer OverhaulUsed byIllustrious/ Pony/ SDXL Pro Grade Workflow (Low or High VRAM) — V13.1 tune upUsed bySillytavern Expressions Workflow — v2Used byComfyUI inpaint workflow | Updated for anima — XL V2.15-maskopacityUsed bySillytavern Expressions Workflow — HyperXUsed byWAN 2.1 VACE - Extend, Crop+Stitch, Extra frame workflowUsed byWan2.2 FunControl FreeLength V2V with Background Changer (Version 2) — v2.0Used byIllustrious/ Pony/ SDXL Pro Grade Workflow (Low or High VRAM) — V15.0.4 Detailer OverhaulUsed byIllustrious/ Pony/ SDXL Pro Grade Workflow (Low or High VRAM) — V16.0 sampler upgradeUsed byTrue 8K Ultra HD Z-image+++Qwen3 Auto Image Enhancement V2 (6 minutes 30 seconds) — v1.0Used byComfyui SDXL full pipeline — v1.0Used byIllustrious/ Pony/ SDXL SFW & NSFW Pro Grade Workflow (Low and high VRAM) — v12 Sampler UpgradeUsed byFrame morphing — v3.0Used byFlux2 Klein Swap Anyting ( face, outfit, food, NSWF..) — v1.0Used bySexiam Img2Img 2.0 — v1.0Used byComfyUI inpaint workflow | Updated for anima — XL V2fixUsed byWan Vace 2.1 Flow Archive — facefixingUsed byIllustrious/ Pony/ SDXL Pro Grade Workflow (Low or High VRAM) — v14.1 Cnet OverhaulUsed bySillytavern Expressions Workflow — v3Used byFlux2 Klein Swap Anyting ( face, outfit, food, NSWF..) — v1.1Used byLooping detailer / inpaint / fixer — v1.0Used byFlux2 Klein Swap Anyting ( face, outfit, food, NSWF..) — V2Used bySynariAI / OFMTech / MarlAI - OFM Tech 2.0 — v1.0Used byWan2.2 FunControl FreeLength V2V with Background Changer (Version 2) — v1.0Used byReference Fill (flux-fill-dev + deepseek-Janus-Pro) — v1.0Used byQwen Image Edit 2511 Factory Version 2 (Regular Use/BG Expand/Inpaint/Pose Changer, Refiners, SeedVR2 Upscaler) — v1.0Used byQwenImageEdit2509_TI2I-WorkflowUsed byIllustrious/ Pony/ SDXL Pro Grade Workflow (Low or High VRAM) — V12.1.0.3 Inpaint w/cnetUsed byFrame morphing — v2.0Used byJonXL's DirectWan V6 - Wan 2.1 (+VACE Stand-In) + 2.2 Advanced V6 Workflow - T2I T2V I2V FLF2V (Trim, Extend, Upscale, Interpolate, Overlay) Workflow — Version 6.0f

Sources

3 sources

Source excerpts

1 excerpt

Source context: Repo BadCafeCode/masquerade-nodes-comfyui