LayerStyle

2167
By chflame
Updated 15 days ago
View on GitHub →See Common Issues →

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.

Available Nodes

LayerUtility: LayerMaskTransform

LayerUtility: LayerMaskTransform Node Documentation

Introduction

The LayerUtility: LayerMaskTransform node in the ComfyUI framework is designed for advanced image manipulation, particularly focusing on mask transformations. This node allows users to perform multiple transformations on mask images, such as scaling, rotating, and mirroring, among others. It is particularly useful for users working with layered image compositions who require precise control over how individual masks are manipulated.

Node Functionality

What This Node Does

This node primarily transforms mask images using a series of specified parameters. It uses several image manipulation techniques to adjust the position, scale, rotation, and mirroring of mask layers. The node processes the incoming mask and produces a transformed version based on the inputs provided, making it ideal for applications where mask accuracy and precision are essential.

Inputs

Below is a detailed list of inputs that the LayerMaskTransform node accepts:

  • mask: This is the primary input representing the mask that needs to be transformed. It is required for any transformation to occur.

  • x: An integer input that controls the horizontal offset applied to the transformed mask. The default value is 0, and it can range from -99,999 to 99,999.

  • y: An integer input that controls the vertical offset applied to the transformed mask. The default value is 0, with the same possible range as the x input.

  • mirror: This input allows for mirroring transformations, with options for 'None', 'horizontal', and 'vertical' mirroring. It specifies whether and how the mask should be flipped.

  • scale: A float input defining the scale factor for resizing the mask. The default value is 1, with a range from 0.01 to 100.

  • aspect_ratio: A float input that adjusts the aspect ratio of the mask during scaling. The default value is 1, with a range from 0.01 to 100.

  • rotate: A float input that specifies the degree of rotation applied to the mask. The default is 0 degrees, and the range is from -999,999 to 999,999 degrees.

  • transform_method: This input determines the resizing method used during transformation. Supported methods include 'lanczos', 'bicubic', 'hamming', 'bilinear', 'box', and 'nearest'.

  • anti_aliasing: An integer input that controls the level of anti-aliasing applied. The default value is 2, with a minimum of 0 and a maximum of 16.

Outputs

  • mask: The output is a transformed version of the original mask. It retains the same format as the input mask but reflects all the transformations specified by the input parameters.

Use in ComfyUI Workflows

In ComfyUI workflows, this node is used to manipulate the appearance and orientation of mask layers within an image composition project. By integrating this node into a workflow, users can:

  1. Prepare masks for further compositing with other image layers.
  2. Align masks precisely within complex graphics or UI projects.
  3. Experiment with different transformative effects to achieve the desired visual results.
  4. Ensure consistency and accuracy of mask positioning across multiple compositions.

Special Features and Considerations

  • Batch Processing: This node is capable of processing multiple masks at once, which is efficient for workflows involving multiple layers.

  • Comprehensive Control: Users have fine-grained control over mask properties, with parameters allowing for a wide range of transformations.

  • Method Variety: Different transformation methods offer flexibility for achieving specific visual qualities in resized or transformed masks.

  • Performance: While offering a robust feature set, consider the computational cost associated with high-resolution masks or batch processing scenarios.

Conclusion

The LayerUtility: LayerMaskTransform node is a powerful component within ComfyUI for anyone needing detailed manipulation of image masks. Its rich feature set coupled with precise control options makes it indispensable for complex image processing and UI design projects. With this node, users can transform their masks to fit seamlessly into any visual scenario they are creating.