ComfyUI > Nodes > ComfyI2I > Mask Ops

ComfyUI Node: Mask Ops

Class Name

Mask Ops

Category
I2I
Author
ManglerFTW (Account age: 664days)
Extension
ComfyI2I
Latest Updated
2024-06-14
Github Stars
0.14K

How to Install ComfyI2I

Install this extension via the ComfyUI Manager by searching for ComfyI2I
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyI2I 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

Mask Ops Description

Versatile node for manipulating image masks with various operations to refine and customize masked areas effectively.

Mask Ops:

Mask Ops is a versatile node designed to perform various operations on image masks, which are essential in image processing and AI art creation. This node allows you to manipulate masks based on different parameters, enabling you to refine and customize the masked areas of your images. Whether you need to blend, invert, blur, or adjust the levels of your masks, Mask Ops provides a comprehensive set of tools to achieve your desired effects. By leveraging these capabilities, you can enhance the precision and quality of your image editing tasks, making it easier to create complex and visually appealing compositions.

Mask Ops Input Parameters:

image

This parameter represents the input image on which the mask operations will be performed. It is essential as it provides the base image data that will be manipulated according to the specified mask operations.

text

This parameter allows you to input text that can be used in conjunction with the mask operations. The text can influence the mask creation or modification process, depending on the specific use case.

separate_mask

This boolean parameter determines whether the mask should be processed separately from the image. If set to true, the mask operations will be applied independently, allowing for more precise control over the mask. The default value is false.

text_sigma

This parameter controls the sigma value for text-based mask operations. It affects the spread or blur of the text within the mask, influencing the softness or sharpness of the text edges. The value can be adjusted to achieve the desired effect.

use_text

This boolean parameter specifies whether the input text should be used in the mask operations. If set to true, the text will be incorporated into the mask processing, allowing for text-based mask modifications. The default value is false.

blend_percentage

This parameter defines the percentage of blending between the original image and the mask. It allows you to control the intensity of the mask effect on the image, with a range from 0.0 to 1.0. The default value is 0.5.

black_level

This parameter sets the black level threshold for the mask. Pixels with values below this threshold will be considered part of the mask. It helps in defining the areas of the image that should be masked out. The value ranges from 0.0 to 1.0, with a default of 0.0.

mid_level

This parameter sets the mid-level threshold for the mask. It defines the midpoint value for mask intensity, allowing for finer control over the mask's gradient. The value ranges from 0.0 to 1.0, with a default of 0.5.

white_level

This parameter sets the white level threshold for the mask. Pixels with values above this threshold will be considered part of the mask. It helps in defining the areas of the image that should remain visible. The value ranges from 0.0 to 1.0, with a default of 1.0.

channel

This parameter specifies the color channel to be used for mask operations. Options include "red", "green", "blue", and "alpha". Selecting the appropriate channel allows for targeted mask modifications based on the chosen color component.

shrink_grow

This parameter controls the amount by which the mask should be shrunk or grown. Positive values will expand the mask, while negative values will contract it. This allows for precise adjustments to the mask size, with a default value of 0.

invert

This boolean parameter determines whether the mask should be inverted. If set to true, the mask values will be flipped, turning masked areas into visible areas and vice versa. The default value is false.

blur_radius

This parameter sets the radius for blurring the mask. A higher value will result in a more blurred mask, creating smoother transitions between masked and unmasked areas. The value can be adjusted to achieve the desired level of blur, with a default of 5.0.

mask

This parameter represents the input mask to be used in the operations. It provides the initial mask data that will be manipulated according to the specified parameters.

Mask Ops Output Parameters:

mask_image

This output parameter provides the resulting image after the mask operations have been applied. It reflects the combined effect of the input image and the modified mask, showcasing the final composition.

mask

This output parameter provides the modified mask after the operations have been applied. It reflects the changes made to the original mask based on the specified parameters, allowing for further use or analysis.

mask mapping

This output parameter provides the mapping of the mask operations, detailing how the input parameters influenced the final mask. It serves as a reference for understanding the modifications made during the process.

Mask Ops Usage Tips:

  • Experiment with different blend_percentage values to achieve the perfect balance between the original image and the mask effect.
  • Use the invert parameter to quickly switch between masked and unmasked areas, which can be useful for creating contrasting effects.
  • Adjust the blur_radius to smooth out harsh edges in the mask, creating more natural transitions in your compositions.
  • Utilize the separate_mask parameter to fine-tune the mask independently from the image, allowing for more precise control over the masked areas.

Mask Ops Common Errors and Solutions:

"Invalid mask input"

  • Explanation: This error occurs when the provided mask input is not in the correct format or is missing.
  • Solution: Ensure that the mask input is correctly specified and matches the expected format.

"Channel not recognized"

  • Explanation: This error occurs when an invalid channel is selected for the mask operations.
  • Solution: Verify that the channel parameter is set to one of the valid options: "red", "green", "blue", or "alpha".

"Threshold values out of range"

  • Explanation: This error occurs when the black_level, mid_level, or white_level parameters are set outside the acceptable range of 0.0 to 1.0.
  • Solution: Adjust the threshold values to be within the specified range to avoid this error.

"Blur radius too high"

  • Explanation: This error occurs when the blur_radius parameter is set to an excessively high value, causing performance issues.
  • Solution: Reduce the blur_radius value to a more reasonable level to ensure smooth operation.

"Text input missing"

  • Explanation: This error occurs when the use_text parameter is set to true, but no text input is provided.
  • Solution: Provide the necessary text input or set the use_text parameter to false if text-based mask operations are not needed.

Mask Ops Related Nodes

Go back to the extension to check out more related nodes.
ComfyI2I
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.