masquerade-nodes-comfyui
A powerful set of mask-related nodes for ComfyUI
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.)
- Fine control over composition via automatic photobashing (see
examples/composition-by-photobashing.json) CompositionExample - Inpaint all faces at a higher resolution (see
examples/inpaint-faces.json) FaceInpaintingExample - Inpaint all buildings with a particular LORA (see
examples/inpaint-with-lora.json) LoRAInpaintingExample - 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
- Thresholded Mask - The calculated mask after taking precision and normalization into account.
- 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 -> UnionandCombine 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
- 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
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
Related resources
34 connectionsSources
3 sources
Sources
3 sourcesVerified Jul 15
Source excerpts
1 excerpt
Source excerpts
1 excerptSource context: Repo BadCafeCode/masquerade-nodes-comfyui
