chflame163 / ComfyUI_LayerStyle

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
MIT License
1.53k stars 87 forks source link

ComfyUI Layer Style

中文说明点这里

商务合作请联系email chflame@163.com.

For business cooperation, please contact email chflame@163.com.

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

It migrate some basic functions of PhotoShop to ComfyUI, aiming to centralize the workflow and reduce the frequency of software switching.

image
*this workflow (title_example_workflow.json) is in the workflow directory.

Example workflow

Some JSON workflow files in the workflow directory, That's examples of how these nodes can be used in ComfyUI.

How to install

(Taking ComfyUI official portable package and Aki ComfyUI package as examples, please modify the dependency environment directory for other ComfyUI environments)

Install plugin

Install dependency packages

  for ComfyUI official portable package, type:

..\..\..\python_embeded\python.exe -s -m pip install .\whl\docopt-0.6.2-py2.py3-none-any.whl
..\..\..\python_embeded\python.exe -s -m pip install .\whl\hydra_core-1.3.2-py3-none-any.whl
..\..\..\python_embeded\python.exe -s -m pip install -r requirements.txt
.\repair_dependency.bat

  for Aki ComfyUI package, type:

..\..\python\python.exe -s -m pip install .\whl\docopt-0.6.2-py2.py3-none-any.whl
..\..\python\python.exe -s -m pip install .\whl\hydra_core-1.3.2-py3-none-any.whl
..\..\python\python.exe -s -m pip install -r requirements.txt
.\repair_dependency.bat

Download Model Files

Chinese domestic users from BaiduNetdisk and other users from huggingface.co/chflame163/ComfyUI_LayerStyle
download all files and copy them to ComfyUI\models folder. This link provides all the model files required for this plugin. Or download the model file according to the instructions of each node.

Common Issues

If the node cannot load properly or there are errors during use, please check the error message in the ComfyUI terminal window. The following are common errors and their solutions.

Warning: xxxx.ini not found, use default xxxx..

This warning message indicates that the ini file cannot be found and does not affect usage. If you do not want to see these warnings, please modify all *.ini.example files in the plugin directory to *.ini.

ModuleNotFoundError: No module named 'psd_tools'

This error is that the psd_tools were not installed correctly.

Solution:

Cannot import name 'guidedFilter' from 'cv2.ximgproc'

This error is caused by incorrect version of the opencv-contrib-python package,or this package is overwriteen by other opencv packages.

NameError: name 'guidedFilter' is not defined

The reason for the problem is the same as above.

Cannot import name 'VitMatteImageProcessor' from 'transformers'

This error is caused by the low version of transformers package.

insightface Loading very slow

This error is caused by the low version of protobuf package.

For the issues with the above three dependency packages, please double click repair_dependency.bat (for Official ComfyUI Protable) or repair_dependency_aki.bat (for ComfyUI-aki-v1.x) in the plugin folder to automatically fix them.

onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page

Solution: Reinstall the onnxruntime dependency package.

Error loading model xxx: We couldn't connect to huggingface.co ...

Check the network environment. If you cannot access huggingface.co normally in China, try modifying the huggingface_hub package to force the use hf_mirror.

ValueError: Trimap did not contain foreground values (xxxx...)

This error is caused by the mask area being too large or too small when using the PyMatting method to handle the mask edges.

Solution:

Requests.exceptions.ProxyError: HTTPSConnectionPool(xxxx...)

When this error has occurred, please check the network environment.

UnboundLocalError: local variable 'clip_processor' referenced before assignment

UnboundLocalError: local variable 'text_model' referenced before assignment

If this error occurs when executing JoyCaption2 node and it has been confirmed that the model file has been placed in the correct directory, please check the transformers dependency package version is at least 4.43.2 or higher. If transformers version is higher than or equal to 4.45.0, and also have error message:

Error loading models: De️️scriptors cannot be created directly.                                                                                           
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.                                
......

Please try downgrading the protobuf dependency package to 3.20.3, or set environment variables: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python.

Update

**If the dependency package error after updating, please double clicking repair_dependency.bat (for Official ComfyUI Protable) or repair_dependency_aki.bat (for ComfyUI-aki-v1.x) in the plugin folder to reinstall the dependency packages.

Description

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

LayerStyle

image
image

DropShadow

Generate shadow image

Node options: image

OuterGlow

Generate outer glow image

Node options: image

InnerShadow

Generate inner shadow image

Node options: image

InnerGlow

Generate inner glow image

Node options:
image

Stroke

Generate a stroke of layer。 image

Node options:
image

GradientOverlay

Generate gradient overlay image

Node options:

ColorOverlay

Generate color overlay image

Node options: image

LayerColor

image
image

LUT Apply

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

Node options:
image

*LUT folder is defined in resource_dir.ini, this file is located in the root directory of the plug-in, and the default name is resource_dir.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open the text editing software and find the line starting with "LUT_dir=", after "=", enter the custom folder path name. support defining multiple folders in resource-dir.ini, separated by commas, semicolons, or spaces. 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.

AutoAdjust

Automatically adjust the brightness, contrast, and white balance of the image. Provide some manual adjustment options to compensate for the shortcomings of automatic adjustment. image

Node Options:
image

AutoAdjustV2

On the basis of AutoAdjust, add mask input and only calculate the content inside the mask for automatic color adjustment. Add multiple automatic adjustment modes. image

The following changes have been made based on AutoAdjust: image

AutoBrightness

Automatically adjust too dark or too bright image to moderate brightness, and support mask input. When mask input, only the content of the mask part is used as the data source of the automatic brightness. The output is still the whole adjusted image. image

Node options:
image

ColorAdapter

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

Node options:
image

Exposure

Change the exposure of the image. image

Color of Shadow & Highlight

Adjust the color of the dark and bright parts of the image. image

Node options:
image

Node option:

Color of Shadow HighlightV2

A replica of the Color of Shadow & Highlight node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors.

ColorTemperature

image
Change the color temperature of the image.

Node Options:
image

Levels

image
Change the levels of image.

Node Options:
image

*If the black_point or output_black_point value is greater than white_point or output_white_point, the two values are swapped, with the larger value used as white_point and the smaller value used as black_point.

ColorBalance

image
Change the color balance of an image.

Node Options:
image

Gamma

Change the gamma value of the image.

Node options:
image

Brightness & Contrast

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

Node options:
image

BrightnessContrastV2

A replica of the Brightness & Contrast node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors.

RGB

Adjust the RGB channels of the image.

Node options:
image

YUV

Adjust the YUV channels of the image.

Node options:
image

LAB

Adjust the LAB channels of the image.

Node options:
image

HSV

Adjust the HSV channels of the image.

Node options:
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

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

Output:

CropByMaskV2

The V2 upgraded version of CropByMask. Supports crop_box input, making it easy to cut layers of the same size.

The following changes have been made based on CropByMask: image

RestoreCropBox

Restore the cropped image to the original image by CropByMask.

Node options:
image

CropBoxResolve

Parsing the corp_box to x , y , width , height . image

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

Outputs:

ImageScaleRestoreV2

The V2 upgraded version of ImageScaleRestore.

Node options:
image
The following changes have been made based on ImageScaleRestore:

ImageMaskScaleAs

Scale the image or mask to the size of the reference image (or reference mask). image

Node options: image

*Only limited to input images and masks. forcing the integration of other types of inputs will result in node errors.

Outputs:

ImageScaleByAspectRatio

Scale the image or mask by aspect ratio. the scaled size can be rounded to a multiple of 8 or 16, and can be scaled to the long side size. image

Node options:
image

Outputs:

ImageScaleByAspectRatioV2

V2 Upgraded Version of ImageScaleByAspectRatio

Node options:
image
The following changes have been made based on ImageScaleByAspectRatio:

QWenImage2Prompt

Inference the prompts based on the image. this node is repackage of the ComfyUI_VLM_nodes's UForm-Gen2 Qwen Node, thanks to the original author. Download model files from huggingface or Baidu Netdisk to ComfyUI/models/LLavacheckpoints/files_for_uform_gen2_qwen folder.

image

Node Options:

LlamaVision

Use the Llama 3.2 vision model for local inference. Can be used to generate prompt words. part of the code for this node comes from ComfyUI-PixtralLlamaMolmoVision, thank you to the original author. To use this node, the transformers need upgraded to 4.45.0 or higher. Download models from BaiduNetdisk or huggingface/SeanScripts , and copy to ComfyUI/models/LLM. image

Node Options:
image

JoyCaption2

Use the JoyCaption-alpha-two model for local inference. Can be used to generate prompt words. this node is https://huggingface.co/John6666/joy-caption-alpha-two-cli-mod Implementation in ComfyUI, thank you to the original author. Download models form BaiduNetdisk and BaiduNetdisk , or huggingface/Orenguteng and huggingface/unsloth , then copy to ComfyUI/models/LLM, Download models from BaiduNetdisk or huggingface/google , and copy to ComfyUI/models/clip, Donwload the cgrkzexw-599808 folder from BaiduNetdisk or huggingface/John6666 , and copy to ComfyUI/models/Joy_captionimage

Node Options:
image

JoyCaption2Split

The node of JoyCaption2 separate model loading and inference, and when multiple JoyCaption2 nodes are used, the model can be shared to improve efficiency.

Node Options:
image

LoadJoyCaption2Model

JoyCaption2's model loading node, used in conjunction with JoyCaption2Split.

Node Options:
image

JoyCaption2ExtraOptions

The extra_options parameter node of JoyCaption2.

Node Options:
image

PhiPrompt

Use Microsoft Phi 3.5 text and visual models for local inference. Can be used to generate prompt words, process prompt words, or infer prompt words from images. Running this model requires at least 16GB of video memory. Download model files from BaiduNetdisk or huggingface.co/microsoft/Phi-3.5-vision-instruct and huggingface.co/microsoft/Phi-3.5-mini-instruct and copy to ComfyUI\models\LLM folder. image

Node Options:
image

UserPromptGeneratorTxtImg

UserPrompt preset for generating SD text to image prompt words.

Node options:
image

UserPromptGeneratorTxtImgWithReference

UserCompt preset for generating SD text to image prompt words based on input content.

Node options:
image

UserPromptGeneratorReplaceWord

UserPrompt preset used to replace a keyword in text with different content. This is not only a simple replacement, but also a logical sorting of the text based on the context of the prompt words to achieve the rationality of the output content.

Node options:
image

PromptTagger

Inference the prompts based on the image. it can replace key word for the prompt. This node currently uses Google Gemini API as the backend service. Please ensure that the network environment can use Gemini normally. Please apply for your API key on Google AI Studio, And fill it in api_key.ini, this file is located in the root directory of the plug-in, and the default name is api_key.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open it using text editing software, fill in your API key after google_api_key= and save it. image

Node options:
image

PromptEmbellish

Enter simple prompt words, output polished prompt words, and support inputting images as references, and support Chinese input. This node currently uses Google Gemini API as the backend service. Please ensure that the network environment can use Gemini normally. Please apply for your API key on Google AI Studio, And fill it in api_key.ini, this file is located in the root directory of the plug-in, and the default name is api_key.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open it using text editing software, fill in your API key after google_api_key= and save it. image

Node options:
image

Florence2Image2Prompt

Use the Florence 2 model to infer prompt words. The code for this node section is fromyiwangsimple/florence_dw, thanks to the original author. *When using it for the first time, the model will be automatically downloaded. You can also download the model file from BaiduNetdisk to ComfyUI/models/florence2 folder. image

Node Options: image

VQAPrompt

Use the blip-vqa model for visual question answering. Part of the code for this node is referenced from celoron/ComfyUI-VisualQueryTemplate, thanks to the original author.
*Download model files from BaiduNetdisk or huggingface.co/Salesforce/blip-vqa-capfilt-large and huggingface.co/Salesforce/blip-vqa-base and copy to ComfyUI\models\VQA folder.

image

Node Options: image

LoadVQAModel

Load the blip-vqa model.

Node Options: image

ImageShift

Shift the image. this node supports the output of displacement seam masks, making it convenient to create continuous textures. image

Node options:
image

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

ImageReel

Display multiple images in one reel. Text annotations can be added to each image in the reel. By using the ImageReelComposite node, multiple reel can be combined into one image. image

Node Options:
image

Output:

ImageReelComposite

Combine multiple reel into one image.

Node Options: image

ImageOpacity

Adjust image opacity image

Node option:

ColorPicker

Modify web extensions from mtb nodes. Select colors on the color palette and output RGB values, thanks to the original author. image

Node options:

Output type:

RGBValue

Output the color value as a single R, G, B three decimal values. Supports HEX and DEC formats for ColorPicker node output.

image

Node Options:

HSVValue

Output color values as individual decimal values of H, S, and V (maximum value of 255). Supports HEX and DEC formats for ColorPicker node output. image

Node Options:

GrayValue

Output grayscale values based on color values. Supports outputting 256 level and 100 level grayscale values. image

Node Options:

Outputs:

GetColorTone

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

Node options: image

Output type:

GetColorToneV2

V2 upgrade of GetColorTone. You can specify the dominant or average color to get the body or background. image

The following changes have been made on the basis of GetColorTong: image

Output:

GetMainColors

Obtain the main color of the image. You can obtain 5 colors. image image

Node Options: image

Outputs:

ColorName

Output the most similar color name in the color palette based on the color value. image

Node Options: image

Output:

ExtendCanvas

Extend the canvas image

Node options: image

ExtendCanvasV2

V2 upgrade to ExtendCanvas.

Based on ExtendCanvas, color is modified to be a string type, and it supports external ColorPicker input, Support negative value input, it means image will be cropped. image

XY to Percent

image
Convert absolute coordinates to percentage coordinates.

image
Node options:

LayerImageTransform

image
This node is used to transform layer_image separately, which can change size, rotation, aspect ratio, and mirror flip without changing the image size.

image
Node options:

LayerMaskTransform

Similar to LayerImageTransform node, this node is used to transform the layer_mask separately, which can scale, rotate, change aspect ratio, and mirror flip without changing the mask size.

image
Node options:

ColorImage

image
Generate an image of a specified color and size.

image
Node options:

ColorImageV2

The V2 upgraded version of ColorImage.

image
The following changes have been made based on ColorImage:

*Only limited to input images and masks. forcing the integration of other types of inputs will result in node errors. **The preset size is defined in custom_size.ini, this file is located in the root directory of the plug-in, and the default name is custom_size.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open with text editing software. Each row represents a size, with the first value being width and the second being height, separated by a lowercase "x" in the middle. To avoid errors, please do not enter extra characters.

GradientImage

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

image
Node options:

GradientImageV2

The V2 upgraded version of GradientImage.

image
The following changes have been made based on GradientImage:

*Only limited to input images and masks. forcing the integration of other types of inputs will result in node errors. **The preset size is defined in custom_size.ini, this file is located in the root directory of the plug-in, and the default name is custom_size.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open with text editing software. Each row represents a size, with the first value being width and the second being height, separated by a lowercase "x" in the middle. To avoid errors, please do not enter extra characters.

ImageRewardFilter

image
Rating bulk pictures and outputting top-ranked pictures. it used [ImageReward] (https://github.com/THUDM/ImageReward) for image scoring, thanks to the original authors.

image
Node options:

Outputs:

SimpleTextImage

image
Generate simple typesetting images and masks from text. This node references some of the functionalities and code of ZHO-ZHO-ZHO/ComfyUI-Text_Image-Composite, thanks to the original author.

image
Node options:

*Only limited to input image and mask. forcing the integration of other types of inputs will result in node errors.

**The font folder is defined in resource_dir.ini, this file is located in the root directory of the plug-in, and the default name is resource_dir.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open the text editing software and find the line starting with "FONT_dir=", after "=", enter the custom folder path name. support defining multiple folders in resource-dir.ini, separated by commas, semicolons, or spaces. all font 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 font folder that comes with the plugin will be enabled.

TextImage

image
Generate images and masks from text. support for adjusting the spacing between words and lines, horizontal and vertical adjustments, it can set random changes in each character, including size and position.

image
Node options:

*Only limited to input image and mask. forcing the integration of other types of inputs will result in node errors.

**The font folder is defined in resource_dir.ini, this file is located in the root directory of the plug-in, and the default name is resource_dir.ini.example. to use this file for the first time, you need to change the file suffix to .ini. Open the text editing software and find the line starting with "FONT_dir=", after "=", enter the custom folder path name. support defining multiple folders in resource-dir.ini, separated by commas, semicolons, or spaces. all font 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 font folder that comes with the plugin will be enabled.

TextImageV2

image

This node is merged from heshengtao. The PR modifies the scaling of the image text node based on the TextImage node. The font spacing follows the scaling, and the coordinates are no longer based on the top left corner of the text, but on the center point of the entire line of text. Thank you for the author's contribution.

LaMa

image
Erase objects from the image based on the mask. this node is repackage of IOPaint, powered by state-of-the-art AI models, thanks to the original author.
It is have LaMa, LDM, ZITS,MAT, FcF, Manga models and the SPREAD method to erase. Please refer to the original link for the introduction of each model.
Please download the model files from lama models(BaiduNetdisk) or lama models(Google Drive) to ComfyUI/models/lama folder.

Node optons: image

ImageChannelSplit

image
Split the image channel into individual images.

Node options: image

ImageChannelMerge

image
Merge each channel image into one image.

Node options: image

ImageRemoveAlpha

image
Remove the alpha channel from the image and convert it to RGB mode. you can choose to fill the background and set the background color.

Node options: image

ImageCombineAlpha

image
Merge the image and mask into an RGBA mode image containing an alpha channel.

ImageAutoCrop

image
Automatically cutout and crop the image according to the mask. it can specify the background color, aspect ratio, and size for output image. this node is designed to generate the image materials for training models.
*Please refer to the model installation methods for SegmentAnythingUltra and RemBgUltra.

Node options: image

Output: cropped_image: Crop and replace the background image. box_preview: Crop position preview. cropped_mask: Cropped mask.

ImageAutoCropV2

The V2 upgrad version of ImageAutoCrop, it has made the following changes based on the previous version: image

ImageAutoCropV3

Automatically crop the image to the specified size. You can input a mask to preserve the specified area of the mask. This node is designed to generate image materials for training the model.

Node Options: image

Outputs: cropped_image: The cropped image. box_preview: Preview of cutting position.

HLFrequencyDetailRestore

Using low frequency filtering and retaining high frequency to recover image details. Compared to kijai's DetailTransfer, this node is better integrated with the environment while retaining details. image

Node Options:
image

GetImageSize

image
Obtain the width and height of the image.

Output:

ImageHub

Switch output from multiple input images and masks, supporting 9 sets of inputs. All input items are optional. if there is only image or mask in a set of input, the missing item will be output as None. image

Node options:
image

BatchSelector

Retrieve specified images or masks from batch images or masks. image

Node Options:
image

TextJoin

image
Combine multiple paragraphs of text into one.

TextJoinV2

image
Added delimiter options on the basis of TextJoin.

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.

TextBox

image
Output a string.

String

image
Output a string. same as TextBox.

Integer

image
Output a integer value.

Float

image
Output a floating-point value with a precision of 5 decimal places.

Boolean

image
Output a boolean value.

RandomGenerator

Used to generate random value within a specified range, with outputs of int, float, and boolean. Supports batch and list generation, and supports batch generation of a set of different random number lists based on image batch. image

Node Options: image

Outputs: int: Integer random number. float: Float random number. bool: Boolean random number.

RandomGeneratorV2

On the based of RandomGenerator, add the least random range and seed options.

Node Options: image

Outputs: int: Integer random number. float: Float random number. bool: Boolean random number.

NumberCalculator

image
Performs mathematical operations on two numeric values and outputs integer and floating point results. Supported operations include+, -, ```,/,**,//,%```.

* The input only supports boolean, integer, and floating point numbers, forcing in other data will result in error.

NumberCalculatorV2

image
The upgraded version of NumberCalculator has added numerical inputs within nodes and square root operations. The square root operation option is nth_root Note: The input takes priority, and when there is input, the values within the node will be invalid.

BooleanOperator

image
Perform a Boolean operation on two numeric values and output the result*. Supported operations include==, !=, and, or, xor, not, min, max.

* The input only supports boolean, integer, and floating point numbers, forcing in other data will result in error. The and operation between the values outputs a larger number, and the or operation outputs a smaller number.

BooleanOperatorV2

image
The upgraded version of Boolean Operator has added numerical inputs within nodes and added judgments for greater than, less than, greater than or equal to, and less than or equal to. Note: The input takes priority, and when there is input, the values within the node will be invalid.

StringCondition

image
Determine whether the text contains or does not contain substrings, and output a Boolean value.

Node Options:
image

CheckMask

Check if the mask contains enough valid areas and output a Boolean value.

Node Options:
image

CheckMaskV2

On the basis of CheckMask, the method option has been added, which allows for the selection of different detection methods. The area_percent is changed to a floating point number with an accuracy of 2 decimal places, which can detect smaller effective areas.

Node Options:
image

If

image
Switches output based on Boolean conditional input. It can be used for any type of data switching, including but not limited to numeric values, strings, pictures, masks, models, latent, pipe pipelines, etc.

Node Options:
image

SwitchCase

image
Switches the output based on the matching string. It can be used for any type of data switching, including but not limited to numeric values, strings, pictures, masks, models, latent, pipe pipelines, etc. Supports up to 3 sets of case switches. Compare case to switch_condition , if the same, output the corresponding input. If there are the same cases, the output is prioritized in order. If there is no matching case, the default input is output. Note that the string is case sensitive and Chinese and English full-width and half-width.

Node Options:
image

QueueStop

image
Stop the current queue. When executed at this node, the queue will stop. The workflow diagram above illustrates that if the image is larger than 1Mega pixels, the queue will stop executing.

Node Options:
image

PurgeVRAM

image
Clean up GPU VRAM and system RAM. any type of input can be accessed, and when executed to this node, the VRAM and garbage objects in the RAM will be cleaned up. Usually placed after the node where the inference task is completed, such as the VAE Decode node.

Node Options:

SaveImagePlus

image
Enhanced save image node. You can customize the directory where the picture is saved, add a timestamp to the file name, select the save format, set the image compression rate, set whether to save the workflow, and optionally add invisible watermarks to the picture. (Add information in a way that is invisible to the naked eye, and use the ShowBlindWaterMark node to decode the watermark). Optionally output the json file of the workflow.

Node Options: image

* Enter%date for the current date (YY-mm-dd) and %time for the current time (HH-MM-SS). You can enter / for subdirectories. For example, %date/name_%tiem will output the image to the YY-mm-dd folder, with name_HH-MM-SS as the file name prefix.

ImageTaggerSave

image
The node used to save the training set images and their text labels, where the image files and text label files have the same file name. Customizable directory for saving images, adding timestamps to file names, selecting save formats, and setting image compression rates. *The workflow image_tagger_stave.exe is located in the workflow directory.

Node Options: image

* Enter%date for the current date (YY-mm-dd) and %time for the current time (HH-MM-SS). You can enter / for subdirectories. For example, %date/name_%tiem will output the image to the YY-mm-dd folder, with name_HH-MM-SS as the file name prefix.

AddBlindWaterMark

image
Add an invisible watermark to a picture. Add the watermark image in a way that is invisible to the naked eye, and use the ShowBlindWaterMark node to decode the watermark.

Node Options: image

ShowBlindWaterMark

Decoding the invisible watermark added to the AddBlindWaterMark and SaveImagePlus nodes. image

CreateQRCode

Generate a square QR code picture.

Node Options:
image

DecodeQRCode

Decoding the QR code.

Node Options:
image

LoadPSD

image
image
Load the PSD format file and export the layers. Note that this node requires the installation of the psd_tools dependency package, If error occurs during the installation of psd_tool, such as ModuleNotFoundError: No module named 'docopt' , please download docopt's whl and manual install it.

Node Options:
image

Outputs: flat_image: PSD preview image. layer_iamge: Find the layer output. all_layers: Batch images containing all layers.

SD3NegativeConditioning

image
Encapsulate the four nodes of Negative Condition in SD3 into a separate node.

Node Options:
image

LayerMask

image

BlendIfMask

Reproduction of Photoshop's layer Style - Blend If function. This node outputs a mask for layer composition on the ImageBlend or ImageBlendAdvance nodes. mask is an optional input, and if you enter a mask here, it will act on the output. image

Node Options:
image

MaskBoxDetect

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

Node options:
image

Output:

Ultra Nodes

image
Nodes that use ultra fine edge masking processing methods, the latest version of nodes includes: SegmentAnythingUltraV2, RmBgUltraV2, BiRefNetUltra, PersonMaskUltraV2, SegformerB2ClothesUltra and MaskEdgeUltraDetailV2. There are three edge processing methods for these nodes:

*Download all model files from BaiduNetdisk or Huggingface to ComfyUI/models/vitmatte folder.

The following figure is an example of the difference in output between three methods. image

SegmentAnythingUltra

Improvements to ComfyUI Segment Anything, thanks to the original author.

*Please refer to the installation of ComfyUI Segment Anything to install the model. If ComfyUI Segment Anything has been correctly installed, you can skip this step.

Node options:
image

SegmentAnythingUltraV2

The V2 upgraded version of SegmentAnythingUltra has added the VITMatte edge processing method.(Note: Images larger than 2K in size using this method will consume huge memory) image

On the basis of SegmentAnythingUltra, the following changes have been made: image

SAM2Ultra

This node is modified from kijai/ComfyUI-segment-anything-2. Thank to kijai for making significant contributions to the Comfyui community.
SAM2 Ultra node only support single image. If you need to process multiple images, please first convert the image batch to image list.
*Download models from BaiduNetdisk or huggingface.co/Kijai/sam2-safetensors and copy to ComfyUI/models/sam2 folder.

image

Node Options:
image

SAM2VideoUltra

SAM2 Video Ultra node support processing multiple frames of images or video sequences. Please define the recognition box data in the first frame of the sequence to ensure correct recognition.

https://github.com/user-attachments/assets/4726b8bf-9b98-4630-8f54-cb7ed7a3d2c5

https://github.com/user-attachments/assets/b2a45c96-4be1-4470-8ceb-addaf301b0cb

Node Options:
image

ObjectDetectorFL2

Use the Florence2 model to identify objects in images and output recognition box data.
*Download models from BaiduNetdisk and copy to ComfyUI/models/florence2 folder.

Node Options:
image

ObjectDetectorYOLOWorld

Use the YOLO-World model to identify objects in images and output recognition box data.
*Download models from BaiduNetdisk or GoogleDrive and copy to ComfyUI/models/yolo-world folder.

Node Options:
image

ObjectDetectorYOLO8

Use the YOLO-8 model to identify objects in images and output recognition box data.
*Download models from GoogleDrive or BaiduNetdisk and copy to ComfyUI/models/yolo folder.

Node Options:
image

ObjectDetectorMask

Use mask as recognition box data. All areas surrounded by white areas on the mask will be recognized as an object. Multiple enclosed areas will be identified separately.

Node Options:
image

BBoxJoin

Merge recognition box data.

Node Options:
image

DrawBBoxMask

Draw the recognition BBoxes data output by the Object Detector node as a mask.
image

Node Options:
image

EVF-SAMUltra

This node is implementation of EVF-SAM in ComfyUI.
*Please download model files from BaiduNetdisk or huggingface/EVF-SAM2, huggingface/EVF-SAM to ComfyUI/models/EVF-SAM folder(save the models in their respective subdirectories). image

Node Options:
image

Florence2Ultra

Using the segmentation function of the Florence2 model, while also having ultra-high edge details. The code for this node section is from spacepxl/ComfyUI-Florence-2, thanks to the original author. *Download the model files from BaiduNetdisk to ComfyUI/models/florence2 folder.

image

Node Options:
image

LoadFlorence2Model

Florence2 model loader. *When using it for the first time, the model will be automatically downloaded.

image
At present, there are base, base-ft, large, large-ft, DocVQA, SD3-Captioner and base-PromptGen models to choose from.

RemBgUltra

Remove background. compared to the similar background removal nodes, this node has ultra-high edge details.

This node combines the Alpha Matte node of Spacepxl's ComfyUI-Image-Filters and the functionality of ZHO-ZHO-ZHO's ComfyUI-BRIA_AI-RMBG, thanks to the original author.

*Download model files from BRIA Background Removal v1.4 or BaiduNetdisk to ComfyUI/models/rmbg/RMBG-1.4 folder. This model can be used for non-commercial purposes.

image

Node options:
image

RmBgUltraV2

The V2 upgraded version of RemBgUltra has added the VITMatte edge processing method.(Note: Images larger than 2K in size using this method will consume huge memory)

On the basis of RemBgUltra, the following changes have been made: image

BenUltra

It is the implementation of PramaLLC/BEN project in ComfyUI. Thank you to the original author.

Download the BEN_Base.pth and config.json from huggingface or BaiduNetdisk and copy to ComfyUI/models/BEN folder.

image

Node Options: image

LoadBenModel

Load the BEN model.

Node Options:
image

BiRefNetUltra

Using the BiRefNet model to remove background has better recognition ability and ultra-high edge details. The code for the model part of this node comes from Viper's ComfyUI-BiRefNet,thanks to the original author.

*From https://huggingface.co/ViperYX/BiRefNet or BaiduNetdisk download the BiRefNet-ep480.pth,pvt_v2_b2.pth,pvt_v2_b5.pth,swin_base_patch4_window12_384_22kto1k.pth, swin_large_patch4_window12_384_22kto1k.pth 5 files to ComfyUI/models/BiRefNet folder.

image

Node options:
image

BiRefNetUltraV2

This node supports the use of the latest BiRefNet model. *Download model file from BaiduNetdisk or GoogleDrive named BiRefNet-general-epoch_244.pth to ComfyUI/Models/BiRefNet/pth folder. You can also download more BiRefNet models and put them here.

image

Node Options:
image

LoadBiRefNetModel

Load the BiRefNet model.

Node Options:
image

LoadBiRefNetModelV2

This node is a PR submitted by jimlee2048 and supports loading RMBG-2.0 models.

Download model files from huggingface or 百度网盘 and copy to ComfyUI/models/BiRefNet/RMBG-2.0 folder.

Node Options:
image

TransparentBackgroundUltra

Using the transparent-background model to remove background has better recognition ability and speed, while also having ultra-high edge details.

*From googledrive or BaiduNetdisk download all files to ComfyUI/models/transparent-background folder.

image

Node Options:
image

PersonMaskUltra

Generate masks for portrait's face, hair, body skin, clothing, or accessories. Compared to the previous A Person Mask Generator node, this node has ultra-high edge details. The model code for this node comes from a-person-mask-generator, edge processing code from ComfyUI-Image-Filters,thanks to the original author. *Download model files from BaiduNetdisk to ComfyUI/models/mediapipe folder.

image

Node options:
image

PersonMaskUltraV2

The V2 upgraded version of PersonMaskUltra has added the VITMatte edge processing method.(Note: Images larger than 2K in size using this method will consume huge memory)

On the basis of PersonMaskUltra, the following changes have been made: image

*Download all model files from huggingface or BaiduNetdisk to ComfyUI/models/segformer_b2_clothes folder.

Node Options:
image

SegformerUltraV2

image
image
Using the segformer model to segment clothing with ultra-high edge details. Currently supports segformer b2 clothes, segformer b3 clothes and segformer b3 fashion。

Download modelfiles from huggingface or BaiduNetdisk to ComfyUI/models/segformer_b2_clothes folder.
Download modelfiles from huggingface or BaiduNetdisk to ComfyUI/models/segformer_b3_clothes folder.
*Download modelfiles from huggingface or BaiduNetdisk to ComfyUI/models/segformer_b3_fashion folder.

Node Options:
image

SegformerClothesPipiline

Select the segformer clothes model and choose the segmentation content.

Node Options:
image

SegformerFashionPipiline

Select the segformer fashion model and choose the segmentation content.

Node Options:
image

HumanPartsUltra

Used for generate human body parts masks, it is based on the warrper of metal3d/ComfyUI_Human_Parts, thank the original author. This node has added ultra-fine edge processing based on the original work. Download model file from BaiduNetdisk or huggingface and copy to ComfyUI\models\onnx\human-parts folder. image

Node Options:
image

MaskEdgeUltraDetail

Process rough masks to ultra fine edges. This node combines the Alpha Matte and the Guided Filter Alpha nodes functions of Spacepxl's ComfyUI-Image-Filters, thanks to the original author. image

Node options:
image

MaskEdgeUltraDetailV2

The V2 upgraded version of MaskEdgeUltraDetail has added the VITMatte edge processing method.(Note: Images larger than 2K in size using this method will consume huge memory)
This method is suitable for handling semi transparent areas.

On the basis of MaskEdgeUltraDetail, the following changes have been made: image

YoloV8Detect

Use the YoloV8 model to detect faces, hand box areas, or character segmentation. Supports the output of the selected number of channels. Download the model files from GoogleDrive or BaiduNetdisk to ComfyUI/models/yolo folder.

image

Node Options:
image

Outputs:

MediapipeFacialSegment

Use the Mediapipe model to detect facial features, segment left and right eyebrows, eyes, lips, and tooth. *Download the model files from BaiduNetdisk to ComfyUI/models/mediapipe folder.

image

Node Options:
image

MaskByColor

Generate a mask based on the selected color. image

Node Options:
image

ImageToMask

Convert the image to a mask. Supports converting any channel in LAB, RGBA, YUV, and HSV modes into masks, while providing color scale adjustment. Support mask optional input to obtain masks that only include valid parts. image

Node Options:
image

*If the black_point or output_black_point value is greater than white_point or output_white_point, the two values are swapped, with the larger value used as white_point and the smaller value used as black_point.

Shadow & Highlight Mask

Generate masks for the dark and bright parts of the image. image

Node options:
image

Shadow Highlight Mask V2

A replica of the Shadow & Highlight Mask node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors.

PixelSpread

Pixel expansion preprocessing on the masked edge of an image can effectively improve the edges of image composit. image

Node options:
image

MaskByDifferent

Calculate the differences between two images and output them as mask. image

Node options:
image

MaskGrow

Grow and shrink edges and blur the mask image

Node options: image

MaskEdgeShrink

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

Node options: image

Comparison of MaskGrow and MaskEdgeShrink image

MaskMotionBlur

Create motion blur on the mask. image

Node options:
image

MaskGradient

Create a gradient for the mask from one side. please note the difference between this node and the CreateGradientMask node. image

Node options: image

CreateGradientMask

Create a gradient mask. please note the difference between this node and the MaskGradient node. image
image

Node options:
image

*Only limited to input image and mask. forcing the integration of other types of inputs will result in node errors.

MaskStroke

Generate mask contour strokes. image

Node options:
image

MaskGrain

Generates noise for the mask. image

Node Options:
image

MaskPreview

Preview the input mask image

MaskInvert

Invert the mask image

LayerFilter

image

Sharp & Soft

Enhance or smooth out details for image. image

Node options: image

SkinBeauty

Make the skin look smoother. image

Node options: image

WaterColor

Watercolor painting effect image

Node option: image

SoftLight

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

Node options: image

ChannelShake

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

Node options: image

HDR Effects

enhances the dynamic range and visual appeal of input images. This node is reorganize and encapsulate of HDR Effects (SuperBeasts.AI), thanks to the original author. image

Node options: image

Film

Simulate the grain, dark edge, and blurred edge of the film, support input depth map to simulate defocus.
This node is reorganize and encapsulate of digitaljohn/comfyui-propost, thanks to the original author. image

Node options: image

FilmV2

The upgraded version of the Film node adds the fastgrain method on the basis of the previous one, and the speed of generating noise is accelerated by 10 times. The code for fastgrain is from github.com/spacepxl/ComfyUI-Image-Filters BetterFilmGrain node, thanks to the original authors. image

LightLeak

Simulate the light leakage effect of the film. please download model file from Baidu Netdisk or [Google Drive]([light_leak.pkl(Google Drive)(https://drive.google.com/file/d/1DcH2Zkyj7W3OiAeeGpJk1eaZpdJwdCL-/view?usp=sharing)) and copy to ComfyUI/models/layerstyle folder. image

Node options: image

ColorMap

Pseudo color heat map effect. image

Node options: image

MotionBlur

Make the image motion blur image

Node options:

GaussianBlur

Make the image gaussian blur image

Node options:

GaussianBlurV2

Gaussian blur. Change the parameter precision to floating-point number, with a precision of 0.01

Node options: image

AddGrain

Add noise to the picture. image

Node Options: image

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, color_burn, color_dodge, linear_burn, linear_dodge, overlay, soft_light, hard_light, vivid_light, pin_light, linear_light, and hard_mix. all of 19 blend modes in total.
image
*Preview of the blend mode

3 The BlendModeV2 include normal, dissolve, darken, multiply, color burn, linear burn, darker color, lighten, screen, color dodge, linear dodge(add), lighter color, dodge, overlay, soft light, hard light, vivid light, linear light, pin light, hard mix, difference, exclusion, subtract, divide, hue, saturation, color, luminosity, grain extract, grain merge all of 30 blend modes in total.
Part of the code for BlendMode V2 is from Virtuoso Nodes for ComfyUI. Thanks to the original authors. image
*Preview of the Blend Mode V2

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

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

Stars

Star History Chart

statement

LayerStyle nodes follows the MIT license, Some of its functional code comes from other open-source projects. Thanks to the original author. If used for commercial purposes, please refer to the original project license to authorization agreement.