🐳遮罩区域扩展:
The MaskRegionExpandNode is designed to enhance and manipulate specific regions within a mask by expanding them horizontally or vertically. This node is particularly useful for AI artists who need to adjust mask boundaries to achieve desired effects in their artwork. By allowing the expansion of either black or white regions, the node provides flexibility in mask manipulation. It also offers an option for edge smoothing using Gaussian blur, which can create a more natural transition between expanded and non-expanded areas. The node's ability to apply linear gradients during expansion further enhances its utility, enabling smooth transitions and more refined control over the mask's appearance. This makes it an essential tool for artists looking to fine-tune mask regions with precision and creativity.
🐳遮罩区域扩展 Input Parameters:
mask
The mask parameter is the primary input for the node, representing the mask that you wish to expand. It is crucial as it defines the initial boundaries and regions that will be manipulated. The mask should be in a format that the node can process, typically a binary or grayscale image where different regions are distinguished by varying pixel values.
左
The 左 parameter specifies the number of pixels to expand the mask to the left. It allows you to control how much the mask should extend horizontally towards the left side. The minimum value is 0, the maximum is 1000, and the default is 0, meaning no expansion unless specified.
上
The 上 parameter determines the number of pixels to expand the mask upwards. This parameter is essential for vertical expansion towards the top of the image. It has a minimum value of 0, a maximum of 1000, and a default of 0, indicating no upward expansion unless adjusted.
右
The 右 parameter controls the number of pixels to expand the mask to the right. It is used to extend the mask horizontally towards the right side. The parameter ranges from a minimum of 0 to a maximum of 1000, with a default value of 0, meaning no rightward expansion unless specified.
下
The 下 parameter specifies the number of pixels to expand the mask downwards. It is crucial for vertical expansion towards the bottom of the image. The minimum value is 0, the maximum is 1000, and the default is 0, indicating no downward expansion unless adjusted.
扩展区域
The 扩展区域 parameter determines which region of the mask to expand, offering options between "黑色区域" (black region) and "白色区域" (white region). This choice affects how the mask is manipulated, with the default being "黑色区域."
边缘平滑
The 边缘平滑 parameter controls the degree of edge smoothing applied to the expanded regions using Gaussian blur. It ranges from 0 to 50, with a default of 0, meaning no smoothing unless specified. This parameter is useful for creating softer transitions at the edges of expanded areas.
使用渐变
The 使用渐变 parameter allows you to choose whether to apply a linear gradient during the expansion process. Options are "否" (no) and "是" (yes), with the default being "否." When enabled, it provides a gradual transition effect, enhancing the visual quality of the expanded mask.
🐳遮罩区域扩展 Output Parameters:
MASK
The output parameter MASK represents the modified mask after the expansion process. It reflects the changes made based on the input parameters, showing the expanded regions with any applied smoothing or gradient effects. This output is crucial for further processing or integration into your artwork, providing a refined mask that meets your creative needs.
🐳遮罩区域扩展 Usage Tips:
- To achieve a smooth transition between expanded and non-expanded areas, consider using the
边缘平滑parameter to apply Gaussian blur, which can help blend the edges seamlessly. - Experiment with the
使用渐变option to create gradual transitions in the expanded regions, which can add depth and a more natural look to your masks.
🐳遮罩区域扩展 Common Errors and Solutions:
ValueError: 不支持的掩码形状
- Explanation: This error occurs when the input mask has an unsupported shape that the node cannot process.
- Solution: Ensure that your mask is in a compatible format, typically a binary or grayscale image with dimensions (1, H, W) or (H, W).
IndexError: index out of range
- Explanation: This error might happen if the expansion parameters exceed the mask's dimensions.
- Solution: Check the values for
左,上,右, and下to ensure they do not exceed the mask's size. Adjust them to fit within the mask's boundaries.
