ComfyUI Layer Style

A set of nodes for ComfyUI that generate image like Adobe Photoshop's Layer Style.

image

Nodes are divided into four groups according to their functions: LayerStyle, LayerMask, LayerUtility and LayerFilter.

  • LayerStyle nodes provides layer styles that mimic Adobe Photoshop.
  • LayerColor node group provides color adjustment functionality.
  • LayerMask nodes provides mask assistance tools.
  • LayerUtility nodes provides auxiliary nodes related to layer composit tools and workflows.
  • LayerFilter nodes provides image effect filters.

中文说明点这里

Update

LayerStyle

image image

DropShadow

Generate shadow image

Node options: image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image, shadows are generated according to their shape.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of shadows.
  • opacity: Opacity of shadow.
  • distance_x: Horizontal offset of shadow.
  • distance_y: Vertical offset of shadow.
  • grow: Shadow expansion amplitude.
  • blur: Shadow blur level.
  • shadow_color4: Shadow color.
  • note

OuterGlow

Generate outer glow image

Node options: image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image, grow are generated according to their shape.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of glow.
  • opacity: Opacity of glow.
  • brightness: Luminance of light.
  • glow_range: range of glow.
  • blur:blur of glow.
  • light_color4: Center part color of glow.
  • glow_color4: Edge part color of glow.
  • note

InnerShadow

Generate inner shadow image

Node options: image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image, shadows are generated according to their shape.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of shadows.
  • opacity: Opacity of shadow.
  • distance_x: Horizontal offset of shadow.
  • distance_y: Vertical offset of shadow.
  • grow: Shadow expansion amplitude.
  • blur: Shadow blur level.
  • shadow_color4: Shadow color.
  • note

InnerGlow

Generate inner glow image

Node options:
image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image, grow are generated according to their shape.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of glow.
  • opacity: Opacity of glow.
  • brightness: Luminance of light.
  • glow_range: range of glow.
  • blur:blur of glow.
  • light_color4: Center part color of glow.
  • glow_color4: Edge part color of glow.
  • note

Stroke

Generate a stroke of layer。 image

Node options:
image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image, stroke are generated according to their shape.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of stroke.
  • opacity: Opacity of stroke.
  • stroke_grow: Stroke expansion/contraction amplitude, positive values indicate expansion and negative values indicate contraction.
  • stroke_width: Stroke width.
  • blur: Blur of stroke.
  • stroke_color4: Stroke color, described in hexadecimal RGB format.
  • note

GradientOverlay

Generate gradient overlay image

Node options:

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of gradient.
  • opacity: Opacity of stroke.
  • start_color: Color at the beginning of the gradient.
  • start_alpha: Transparency at the beginning of the gradient.
  • end_color: Color at the end of the gradient.
  • end_alpha: Transparency at the end of the gradient.
  • angle: Gradient rotation angle.
  • note

ColorOverlay

Generate color overlay image

Node options: image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode of color.
  • opacity: Opacity of stroke.
  • color: Color of overlay.
  • note

LayerColor

image

LUT Apply

Apply LUT to the image. only supports .cube format.

Node options:
image

  • LUT*: Here is a list of available. cube files in the LUT folder, and the selected LUT files will be applied to the image.

*LUT folder is defined in resource_dir.ini, this file is located in the root directory of the plugin. Open the text editing software and find the line starting with "LUT dir=", after "=", enter the custom folder path name. all .cube files in this folder will be collected and displayed in the node list during ComfyUI initialization. If the folder set in ini is invalid, the LUT folder that comes with the plugin will be enabled.

ColorAdapter

Auto adjust the color tone of the image to resemble the reference image. image

Node options:
image

  • opacity: The opacity of an image after adjusting its color tone.

Gamma

Change the gamma value of the image.

Node options:
image

  • gamma: Value of the Gamma.

Brightness & Contrast

Change the brightness, contrast, and saturation of the image.

Node options:
image

  • brightness: Value of brightness.
  • contrast: Value of contrast.
  • saturation: Value of saturation.

RGB

Adjust the RGB channels of the image.

Node options:
image

  • R: R channel.
  • G: G channel.
  • B: B channel.

YUV

Adjust the YUV channels of the image.

Node options:
image

  • Y: Y channel.
  • U: U channel.
  • V: V channel.

LAB

Adjust the LAB channels of the image.

Node options:
image

  • L: L channel.
  • A: A channel.
  • B: B channel.

HSV

Adjust the HSV channels of the image.

Node options:
image

  • H: H channel.
  • S: S channel.
  • V: V channel.

LayerMask

image

MaskBoxDetect

Detect the area where the mask is located and output its position and size. image

Node options:
image

  • detect: Detection method, min_bounding_rect is the minimum bounding rectangle, max_inscribed_rect is the maximum inscribed rectangle.
  • x_adjust: Adjust of horizontal deviation after detection.
  • y_adjust: Adjust of vertical offset after detection.
  • scale_adjust: Adjust the scaling offset after detection.

Output:

  • box_preview: Preview image of detection results. Red represents the detected result, and green represents the adjust output result.
  • x_percent: Horizontal position output in percentage.
  • y_percent: Vertical position output in percentage.
  • width: Width.
  • height: Height.
  • x: The x-coordinate of the top left corner position.
  • y: The y-coordinate of the top left corner position.

MaskGrow

Grow and shrink edges and blur the mask image

Node options: image

  • invert_mask: Whether to reverse the mask.
  • grow: Positive values expand outward, while negative values contract inward.
  • blur: Blur the edge.

MaskEdgeShrink

Smooth transition and shrink the mask edges while preserving edge details. image

Node options: image

  • invert_mask: Whether to reverse the mask.
  • shrink_level: Shrink the smoothness level.
  • soft: Smooth amplitude.
  • edge_shrink: Edge shrinkage amplitude.
  • edge_reserve: Preserve the amplitude of edge details, 100 represents complete preservation, and 0 represents no preservation at all.

Comparison of MaskGrow and MaskEdgeShrink image

MaskMotionBlur

Create motion blur on the mask. image

Node options:
image

  • invert_mask: Whether to reverse the mask.
  • blur: The size of blur.
  • angle: The angle of blur.

MaskGradient

Create a gradient for the mask from one side. image

Node options: image

  • invert_mask: Whether to reverse the mask.
  • gradient_side: Generate gradient from which edge. There are four directions: top, bottom, left and right.
  • gradient_scale: Gradient distance. The default value of 100 indicates that one side of the gradient is completely transparent and the other side is completely opaque. The smaller the value, the shorter the distance from transparent to opaque.
  • gradient_offset: Gradient position offset.
  • opacity: The opacity of the gradient.

MaskStroke

Generate mask contour strokes. image

Node options:
image

  • invert_mask: Whether to reverse the mask.
  • stroke_grow: Stroke expansion/contraction amplitude, positive values indicate expansion and negative values indicate contraction.
  • stroke_width: Stroke width.
  • blur: Blur of stroke.

MaskPreview

Preview the input mask image

MaskInvert

Invert the mask image

LayerUtility

image

ImageBlendAdvance

Used for compositing layers, allowing for compositing layer images of different sizes on the background image, and setting positions and transformations. multiple mixing modes are available for selection, and transparency can be set.

The node provide layer transformation_methods and anti_aliasing options. helps improve the quality of synthesized images.

The node provides mask output that can be used for subsequent workflows. image

Node options:
image

  • background_image: The background image.
  • layer_image5: Layer image for composite.
  • layer_mask2,5: Mask for layer_image.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode.
  • opacity: Opacity of blend.
  • x_percent: Horizontal position of the layer on the background image, expressed as a percentage, with 0 on the far left and 100 on the far right. It can be less than 0 or more than 100, indicating that some of the layer's content is outside the screen.
  • y_percent: Vertical position of the layer on the background image, expressed as a percentage, with 0 on the top and 100 on the bottom. For example, setting it to 50 indicates vertical center, 20 indicates upper center, and 80 indicates lower center.
  • mirror: Mirror flipping. Provide two flipping modes, horizontal flipping and vertical flipping.
  • scale: Layer magnification, 1.0 represents the original size.
  • aspect_ratio: Layer aspect ratio. 1.0 is the original ratio, a value greater than this indicates elongation, and a value less than this indicates flattening.
  • rotate: Layer rotation degree.
  • Sampling methods for layer enlargement and rotation, including lanczos, bicubic, hamming, bilinear, box and nearest. Different sampling methods can affect the image quality and processing time of the synthesized image.
  • anti_aliasing: Anti aliasing, ranging from 0 to 16, the larger the value, the less obvious the aliasing. An excessively high value will significantly reduce the processing speed of the node.
  • note

CropByMask

Crop the image according to the mask range, and set the size of the surrounding borders to be retained. This node can be used in conjunction with the RestoreCropBox and ImageScaleRestore nodes to crop and modify upscale parts of image, and then paste them back in place. image

Node options:
image

  • image5: The input image.
  • mask_for_crop5: Mask of the image, it will automatically be cut according to the mask range.
  • invert_mask: Whether to reverse the mask.
  • detect: Detection method, min_bounding_rect is the minimum bounding rectangle, max_inscribed_rect is the maximum inscribed rectangle.
  • top_reserve: Cut the top to preserve size.
  • bottom_reserve: Cut the bottom to preserve size.
  • left_reserve: Cut the left to preserve size.
  • right_reserve: Cut the right to preserve size.
  • note

Output:

  • croped_image: The image after crop.
  • croped_mask: The mask after crop.
  • crop_box: The trimmed box data is used when restoring the RestoreCropBox node.
  • box_preview: Preview image of cutting position, red represents the detected range, and green represents the cutting range after adding the reserved border.

RestoreCropBox

Restore the cropped image to the original image by CropByMask.

Node options:
image

  • background_image: The original image before cutting.
  • croped_image5: The cropped image. If the middle is enlarged, the size needs to be restored before restoration.
  • croped_mask5: The cut mask.
  • crop_box: Box data during cutting.
  • invert_mask: Whether to reverse the mask.
  • note

ImageScaleRestore

Image scaling. when this node is used in pairs, the image can be automatically restored to its original size on the second node. image

Node options:
image

  • image5: The input image.
  • mask2,5: Mask of image.
  • original_size: Optional input, used to restore the image to its original size.
  • scale: Scale ratio. when the original_size have input, or scale_ by_longest_side is set to True, this setting will be ignored.
  • scale_by_longest_side: Allow scaling by long edge size.
  • longest_side: When the scale_by_longest_side is set to True, this will be used this value to the long edge of the image. when the original_size have input, this setting will be ignored.

Outputs:

  • image: The scaled image.
  • mask: If have mask input, the scaled mask will be output.
  • original_size: The original size data of the image is used for subsequent node recovery.

ImageBlend

A simple node for composit layer image and background image, multiple blend modes are available for option, and transparency can be set. image

Node options: image

  • background_image1: The background image.
  • layer_image1: Layer image for composite.
  • layer_mask1,2: Mask for layer_image.
  • invert_mask: Whether to reverse the mask.
  • blend_mode3: Blending mode.
  • opacity: Opacity of blend.
  • note

ImageOpacity

Adjust image opacity image

Node option:

  • image5: Image input, supporting RGB and RGBA. if is RGB, the alpha channel of the entire image will be automatically added.
  • mask2,5 : Mask input.
  • invert_mask: Whether to reverse the mask.
  • opacity: Opacity of image.
  • note

ColorPicker

Modify web extensions from mtb nodes. Select colors on the color palette and output RGB values. image

Node options:

  • mode: The output format is available in hexadecimal (HEX) and decimal (DEC).

Output type:

  • string

GetColorTone

Obtain the main color or average color from the image and output RGB values. image

Node options: image

  • mode: There are two modes to choose from, with the main color and average color.

Output type:

  • string

ExtendCanvas

Extend the canvas image

Node options: image

  • invert_mask: Whether to reverse the mask.
  • top: Top extension value.
  • bottom: Bottom extension value.
  • left: Left extension value.
  • right: Right extension value.
  • color; Color of canvas.

XY to Percent

image Convert absolute coordinates to percentage coordinates.

image Node options:

  • x: Value of X
  • y: Value of Y

ColorImage

image Generate an image of a specified color and size.

image Node options:

  • width: Width of the image.
  • height: Height of the image.
  • color4: Color of the image.

GradientImage

image Generate an image with a specified size and color gradient.

image Node options:

  • width: Width of the image.
  • height: Height of the image.
  • angle: Angle of gradient.
  • start_color4: Color of the begging.
  • end_color4: Color of the ending.

ImageChannelSplit

image Split the image channel into individual images.

Node options: image

  • mode: Channel mode, include RGBA, YCbCr, LAB adn HSV.

ImageChannelMerge

image Merge each channel image into one image.

Node options: image

  • mode: Channel mode, include RGBA, YCbCr, LAB adn HSV.

GetImageSize

image Obtain the width and height of the image.

PrintInfo

image Used to provide assistance for workflow debugging. When running, the properties of any object connected to this node will be printed to the console.

This node allows any type of input.

LayerFilter

image

SoftLight

Soft light effect, the bright highlights on the screen appear blurry. image

Node options: image

  • soft: Size of soft light.
  • threshold: Soft light range. the light appears from the brightest part of the picture. in lower value, the range will be larger, and in higher value, the range will be smaller.
  • opacity: Opacity of the soft light.

ChannelShake

Channel misalignment. similar to the effect of Tiktok logo. image

Node options: image

  • distance: Distance of channel separation.
  • angle: Angle of channel separation.
  • mode: Channel shift arrangement order.

MotionBlur

Make the image motion blur image

Node options:

  • angle: The angle of blur.
  • blur: The size of blur.

GaussianBlur

Make the image gaussian blur image

Node options:

  • blur: The size of blur.

Annotation for notes

1 The layer_image, layer_mask and the background_image(if have input), These three items must be of the same size.

2 The mask not a mandatory input item. the alpha channel of the image is used by default. If the image input does not include an alpha channel, the entire image's alpha channel will be automatically created. if have masks input simultaneously, the alpha channel will be overwrite by the mask.

3 The blend mode include normal, multply, screen, add, subtract, difference, darker and lighter.

4 The RGB color described by hexadecimal RGB format, like '#FA3D86'.

5 The layer_image and layer_mask must be of the same size.

Example workflow

image Some JSON workflow files in the workflow directory, that is example for ComfyUI.

The following tasks are in the planned list

LayerMask:

  • TextMask

LayerFilter:

  • Emboss
  • Contour
  • Findedge
  • PhotoStyle
  • ColorMap

How to install

  • Open the cmd window in the plugin directory of ComfyUI, like "ComfyUI\custom_nodes",typegit clone https://github.com/chflame163/ComfyUI_LayerStyle.git or download the zip file and extracted, copy the resulting folder to ComfyUI\custom_ Nodes\

  • Install dependency packages, open the cmd window in the WordCloud plugin directory like "ComfyUI\custom_ Nodes\ComfyUI_WordCloud" and enter the following command: ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt

  • Restart ComfyUI

S
Description
No description provided
Readme MIT
226 MiB
Languages
Python 93.4%
JavaScript 6.3%
Batchfile 0.3%