A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
The "LayerStyle: Gradient Map" node in the ComfyUI LayerStyle module provides a means to apply a gradient map to an image. This technique is commonly used to stylize images by mapping grayscale values in an image to specific colors, effectively allowing for customized color grading.
The node enables users to convert an image's grayscale data into a color gradient based on user-defined start, middle, and end colors. It allows for the preservation of the original image's luminance and gives options for applying gradient maps with varying opacities. Users can also apply this effect selectively using a custom mask.
The "LayerStyle: Gradient Map" node accepts the following inputs:
Image: The primary image input for which the gradient map effect is to be applied. This must be an image type that ComfyUI recognizes.
Start Color: This is the starting color of the gradient map, specified in a hexadecimal string format (e.g., #015A52
).
Mid Color: This defines the middle color of the gradient. Like the start color, it is also specified as a hexadecimal string (e.g., #02AF9F
).
End Color: The final color of the gradient map, given in hexadecimal form (e.g., #7FFFEC
).
Mid Point: A float value determining the location of the middle color on the gradient scale. The value ranges between 0.0 and 1.0 and correlates with the grayscale intensity.
Opacity: An integer defining the opacity level of the gradient effect, ranging from 0 (fully transparent) to 100 (fully opaque).
Layer Mask (Optional): A mask image which allows selective application of the gradient effect on the primary image. This enables more refined artistic control over which areas of the image are affected.
The node generates the following outputs:
Image: The resulting image after the gradient map effect has been applied.
Gradient: A separate image representing the gradient used, which can be used for further reference or composed in subsequent workflow steps.
The "LayerStyle: Gradient Map" node is versatile and can be incorporated into ComfyUI workflows to enhance images with creative color gradients. It is particularly useful in artistic image rendering, photo editing, or any scenario where dynamic color adjustment is desired:
Artistic Enhancement: Create unique visual styles by altering the grayscale values of an image into a custom color spectrum.
Photo Grading: Quickly shift the mood or tone of an image by applying different gradient colors.
Selective Colorization: Combine with a custom mask to apply gradients to specific parts of an image, leaving other areas untouched.
Luminance Preservation: The node intelligently preserves the luminance of the original image, maintaining light and shadow details while colorizing.
Opacity Control: Users can blend the original image and gradient effect seamlessly using the opacity parameter.
Selective Application: Through the use of an optional mask layer, users can precisely control where the gradient map effect is applied, allowing for more intricate designs.
The ability to customize the gradient colors and mid-point, coupled with mask-based application, makes this node a powerful tool for creative tasks in ComfyUI.