ComfyUI > Nodes > GraftingRayman > GR Image/Depth Mask

ComfyUI Node: GR Image/Depth Mask

Class Name

GR Image_Depth Mask

Category
GraftingRayman/Mask
Author
GraftingRayman (Account age: 193days)
Extension
GraftingRayman
Latest Updated
2024-07-23
Github Stars
0.03K

How to Install GraftingRayman

Install this extension via the ComfyUI Manager by searching for GraftingRayman
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter GraftingRayman in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

GR Image/Depth Mask Description

Generate binary mask from image using depth info for precise region isolation and editing control.

GR Image/Depth Mask:

The GR Image_Depth Mask node is designed to generate a binary mask from an image based on depth information. This node is particularly useful for AI artists who need to isolate specific regions of an image for further processing or manipulation. By leveraging depth data, the node can create precise masks that highlight areas of interest, making it easier to apply effects, transformations, or other modifications selectively. The primary goal of this node is to enhance the control and flexibility you have over image editing tasks, allowing for more detailed and accurate artistic creations.

GR Image/Depth Mask Input Parameters:

image

This parameter represents the input image from which the depth mask will be generated. The image should be in a tensor format, typically obtained from a previous node in the processing pipeline. The quality and resolution of the input image can significantly impact the accuracy of the generated mask.

channel

This parameter specifies which color channel to use for mask generation. Options include "alpha", "red", "green", "blue", and "all". The choice of channel affects the mask's sensitivity to different parts of the image. For example, selecting the "alpha" channel will focus on transparency, while "red", "green", and "blue" will focus on their respective color intensities. The "all" option converts the image to grayscale before processing.

threshold

This parameter sets the threshold value for binary mask creation. It ranges from 0 to 1, with a default value typically around 0.5. Pixels with values above the threshold will be included in the mask, while those below will be excluded. Adjusting the threshold can help fine-tune the mask to better match the desired regions.

invert

This boolean parameter determines whether the generated mask should be inverted. If set to true, the mask will highlight areas that were originally excluded and vice versa. This can be useful for creating negative masks or focusing on background regions.

blur_radius

This parameter controls the amount of Gaussian blur applied to the mask. It is a floating-point value, with higher values resulting in a more blurred mask. Blurring can help smooth out edges and reduce noise in the mask, making it more visually appealing and accurate.

brightness

This parameter adjusts the brightness of the mask. It is a floating-point value, with 1.0 representing no change. Increasing the brightness can make the mask more prominent, while decreasing it can make it less visible.

contrast

This parameter adjusts the contrast of the mask. It is a floating-point value, with 1.0 representing no change. Higher contrast values can make the mask edges sharper and more defined, while lower values can make them softer.

expand

This parameter specifies the number of pixels by which to expand the mask. It is an integer value, with higher values resulting in a larger mask. Expanding the mask can help cover more area around the edges of the selected regions.

contract

This parameter specifies the number of pixels by which to contract the mask. It is an integer value, with higher values resulting in a smaller mask. Contracting the mask can help focus on the core areas of the selected regions, excluding the edges.

blur_radius_expand

This parameter controls the amount of Gaussian blur applied after expanding the mask. It is a floating-point value, with higher values resulting in a more blurred expanded mask. This can help smooth out the edges of the expanded mask.

GR Image/Depth Mask Output Parameters:

mask_tensor

This output parameter is the generated binary mask in tensor format. The mask tensor can be used in subsequent nodes for further image processing tasks. It represents the areas of the input image that meet the specified criteria, allowing for selective editing and manipulation.

GR Image/Depth Mask Usage Tips:

  • Experiment with different channel options to see which one best highlights the regions you want to mask.
  • Adjust the threshold value to fine-tune the mask and achieve the desired level of detail.
  • Use the invert option to quickly switch between focusing on foreground and background regions.
  • Apply Gaussian blur to smooth out the mask edges and reduce noise for a cleaner result.
  • Adjust brightness and contrast to enhance the visibility and definition of the mask.

GR Image/Depth Mask Common Errors and Solutions:

"Invalid image format"

  • Explanation: The input image is not in the expected tensor format.
  • Solution: Ensure that the input image is correctly formatted as a tensor before passing it to the node.

"Threshold value out of range"

  • Explanation: The threshold value is not within the acceptable range of 0 to 1. - Solution: Adjust the threshold value to be within the range of 0 to 1.

"Invalid channel selection"

  • Explanation: The specified channel is not one of the accepted options.
  • Solution: Choose a valid channel option from "alpha", "red", "green", "blue", or "all".

"Blur radius must be non-negative"

  • Explanation: The blur radius value is negative.
  • Solution: Set the blur radius to a non-negative value.

"Expand/Contract value must be non-negative"

  • Explanation: The expand or contract value is negative.
  • Solution: Set the expand and contract values to non-negative integers.

GR Image/Depth Mask Related Nodes

Go back to the extension to check out more related nodes.
GraftingRayman
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.