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: RoundedRectangle

LayerUtility: RoundedRectangle Node Documentation

Overview

The LayerUtility: RoundedRectangle node is a versatile tool within the ComfyUI framework that allows users to create images with rounded rectangles. This node is particularly useful for graphic design tasks where the need to emphasize certain areas of an image with a rounded rectangular overlay arises. It can modify images by applying a rounded rectangle mask with customizable parameters.

Functionality

The main function of this node is to process images and generate a new version of the image with a rounded rectangle applied. It creates a mask in the shape of a rounded rectangle and overlays it onto the original image, providing an outcome that combines both the image data and a mask highlighting the rounded rectangle area.

Inputs

The LayerUtility: RoundedRectangle node accepts the following inputs:

Required Inputs

  • image: The input image on which the rounded rectangle will be applied. This is the source image that will be modified.

  • rounded_rect_radius: An integer value representing the radius of the rounded corners of the rectangle. The value can be set between 0 and 100, with a default of 50.

  • anti_aliasing: An integer value for applying anti-aliasing to smooth the edges of the rectangle. The range for this input is from 0 to 16, with a default setting of 2.

  • top, bottom, left, right: Floating-point values that define the padding around the edges of the rectangle as a percentage of the image dimensions. These can range from -100 to 100, with defaults set at 8.

  • detect: A mode setting among mask_area, min_bounding_rect, and max_inscribed_rect which defines how the rectangle area is detected relative to an object or area of interest within the image.

  • obj_ext_top, obj_ext_bottom, obj_ext_left, obj_ext_right: Floating-point values adjusting the extent of the rectangle's external boundary beyond the detected edges, with ranges from -100 to 100 and defaults set at 8.

Optional Inputs

  • object_mask: An optional mask input used to define areas of interest within the image. If provided, the rectangle detection will consider these areas.

  • crop_box: An optional box input specifying a direct bounding box for the rectangle instead of relying on automatic detection methods.

Outputs

The node produces two outputs:

  • image: The processed image with the rounded rectangle applied. The original image data combined with a mask in an RGBA format.

  • mask: The mask image representing the area of the image covered by the rounded rectangle. This mask can be utilized for further processing or to isolate regions in the original image.

Usage in ComfyUI Workflows

This node is implemented to be used in diverse ComfyUI workflows, especially when there is a need to visually highlight specific areas of an image. It can be integrated into larger image processing pipelines where modifications to shape and appearance are required. The customization options, such as corner radius and padding, provide flexibility to fit various design requirements.

Special Features and Considerations

  • Customization: This node offers extensive customization through its input parameters, enabling users to tailor the shape and appearance of the rounded rectangle to meet specific needs.

  • Detection Modes: It features multiple detection modes (mask_area, min_bounding_rect, and max_inscribed_rect) that determine how the rectangle is applied relative to another object or feature in the image.

  • Anti-aliasing: With adjustable anti-aliasing, the node can smooth out edges, providing a polished and professional look.

  • Flexible Integration: As an integral part of ComfyUI workflows, it can be combined with other nodes to automate complex image processing tasks.

This node is an essential tool for users looking to add emphasis and style to specific areas of images, facilitating creative expression and enhanced visual output.