ComfyUI > Nodes > ComfyUI-Portrait-Maker > ExpandMaskBox PM

ComfyUI Node: ExpandMaskBox PM

Class Name

PM_ExpandMaskBox

Category
protrait/other
Author
THtianhao (Account age: 3700days)
Extension
ComfyUI-Portrait-Maker
Latest Updated
2024-05-22
Github Stars
0.17K

How to Install ComfyUI-Portrait-Maker

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

ExpandMaskBox PM Description

Modify mask width within bounding box for precise masking effects, ideal for AI artists and image editing projects.

ExpandMaskBox PM:

The PM_ExpandMaskBox node is designed to modify a given mask by expanding its width within a specified bounding box. This node is particularly useful for AI artists who need to adjust the mask area around a specific region, such as a face, to ensure that the mask covers a slightly larger area than originally defined. By expanding the mask, you can achieve more precise and controlled masking effects, which can be crucial for tasks like portrait editing or other image manipulation projects. The node allows you to specify the amount of expansion and ensures that the expanded mask remains within the image boundaries, providing a seamless and user-friendly experience.

ExpandMaskBox PM Input Parameters:

mask

The mask parameter represents the initial mask that you want to expand. This mask is typically a binary or grayscale image where the masked area is highlighted. The mask should be provided in a format that the node can process, usually as a tensor or array.

box

The box parameter defines the bounding box around the area you want to expand. This is specified as a tuple or list of four integers representing the coordinates (x1, y1, x2, y2) of the top-left and bottom-right corners of the box. The box helps in identifying the region of interest within the mask that needs to be expanded.

expand_width

The expand_width parameter determines the amount by which the mask's width should be expanded. It is a floating-point value with a default of 0.15, a minimum of 0, and a maximum of 10. This parameter allows you to control the extent of the expansion, with higher values resulting in a larger expanded area.

ExpandMaskBox PM Output Parameters:

mask

The mask output is the modified mask after the expansion has been applied. This mask will have the specified region expanded according to the expand_width parameter, ensuring that the new mask covers a larger area as intended.

box

The box output is the updated bounding box that reflects the new coordinates after the mask has been expanded. This helps in understanding the new region covered by the expanded mask and can be used for further processing or adjustments.

ExpandMaskBox PM Usage Tips:

  • To achieve a subtle expansion of the mask, start with a small expand_width value and gradually increase it until you get the desired effect.
  • Ensure that the box parameter accurately defines the region of interest to avoid unintended expansions outside the target area.
  • Use the expanded mask in combination with other nodes for more complex image editing tasks, such as blending or compositing.

ExpandMaskBox PM Common Errors and Solutions:

"Invalid mask shape"

  • Explanation: This error occurs when the input mask does not have the expected dimensions or format.
  • Solution: Ensure that the mask is provided as a tensor or array with the correct shape, typically (height, width) or (1, height, width).

"Box coordinates out of bounds"

  • Explanation: This error happens when the specified box coordinates exceed the dimensions of the mask.
  • Solution: Verify that the box coordinates are within the bounds of the mask dimensions and adjust them if necessary.

"Expand width out of range"

  • Explanation: This error is triggered when the expand_width value is outside the allowed range (0 to 10).
  • Solution: Adjust the expand_width parameter to be within the specified range, ensuring it is between 0 and 10.

ExpandMaskBox PM Related Nodes

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