ComfyOnline
ImpactGaussianBlurMask

ComfyUI-Impact-Pack: Gaussian Blur Mask Node

Introduction:

The ComfyUI-Impact-Pack is a collection of custom nodes for ComfyUI, a powerful and modular stable diffusion GUI. This pack expands ComfyUI's capabilities with a variety of image processing, utility, and workflow enhancement nodes.

Gaussian Blur Mask Introduction

The Gaussian Blur Mask node is a crucial tool for refining and softening masks within ComfyUI workflows. It applies a Gaussian blur algorithm to an input mask, effectively smoothing the edges and creating a more gradual transition between the masked and unmasked areas. This is particularly useful in image compositing, where harsh mask edges can lead to unnatural-looking results. By blurring the mask, you can achieve a more seamless and visually pleasing integration of different image elements.

Gaussian Blur Mask Input Introduction

The Gaussian Blur Mask node accepts the following inputs:

  • mask (MASK): This is the mask you want to blur. Masks are typically grayscale images where the intensity of each pixel represents the degree to which that pixel is masked (white = fully masked, black = not masked, shades of gray = partially masked).
  • sigma (FLOAT): This value controls the intensity of the blur. Higher sigma values result in a stronger blur, while lower values produce a subtle effect. Experiment with different sigma values to achieve the desired level of smoothness.
  • kernel_size (INT): This determines the size of the Gaussian kernel used for blurring. A larger kernel size will result in a more pronounced blur, while a smaller kernel size will produce a more subtle effect. It's typically specified as a single integer, which is then used to create a square kernel (e.g., kernel_size=5 creates a 5x5 kernel). Common values are odd numbers like 3, 5, 7, etc.

Gaussian Blur Mask Output Introduction

The Gaussian Blur Mask node produces a single output:

  • MASK: A blurred version of the input mask. This output can then be used in subsequent nodes for image compositing, blending, or other masking operations.

Gaussian Blur Mask Usage Tips

  • Subtle Blurring for Realistic Compositing: Use small sigma values (e.g., 1-3) and small kernel sizes (e.g. 3 or 5) to subtly blur mask edges for more realistic compositing. This is especially important when combining images with different resolutions or levels of detail.
  • Creating Soft Transitions: Increase the sigma value and kernel size to create a more gradual transition between masked and unmasked areas. This can be useful for creating soft vignettes or feathered edges.
  • Experiment with Sigma and Kernel Size: The optimal sigma value and kernel size depend on the resolution of your image and the desired effect. Don't be afraid to experiment with different values to find what works best for your specific use case. Keep in mind that larger kernel sizes can be more computationally expensive.
  • Combining with Other Masking Nodes: The Gaussian Blur Mask node can be effectively combined with other masking nodes in the ComfyUI-Impact-Pack to create complex and nuanced masking effects. For example, you can use a threshold node to create an initial mask, then use the Gaussian Blur Mask node to soften the edges.
  • Optimizing Performance: High sigma values and large kernel sizes can increase processing time. If performance is a concern, try reducing these values or optimizing your workflow to minimize the number of pixels that need to be processed.

related extension: