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.
*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
-
Recommended use ComfyUI Manager for installation.
-
Or open the cmd window in the plugin directory of ComfyUI, like
ComfyUI\custom_nodes
,type
git 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
-
for ComfyUI official portable package, double-click the
install_requirements.bat
in the plugin directory, for Aki ComfyUI package double-click on theinstall_requirements_aki.bat
in the plugin directory, and wait for the installation to complete. -
Or install dependency packages, open the cmd window in the ComfyUI_LayerStyle plugin directory like
ComfyUI\custom_ Nodes\ComfyUI_LayerStyle
and enter the following command,
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 -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 -r requirements.txt
.\repair_dependency.bat
- Restart ComfyUI.
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:
- Close ComfyUI and open the terminal window in the plugin directory and execute the following command:
../../../python_embeded/python.exe -s -m pip install psd_tools
If error occurs during the installation of psd_tool, such asModuleNotFoundError: No module named 'docopt'
, please download docopt's whl and manual install it. execute the following command in terminal window:../../../python_embeded/python.exe -s -m pip install path/docopt-0.6.2-py2.py3-none-any.whl
thepath
is path name of whl file.
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.
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:
- Please adjust the parameters to change the effective area of the mask. Or use other methods to handle the edges.
Requests.exceptions.ProxyError: HTTPSConnectionPool(xxxx...)
When this error has occurred, please check the network environment.
Update
**If the dependency package error after updating, please reinstall the relevant dependency packages.
- Commit Florence2Ultra, Florence2Image2Prompt and LoadFlorence2Model nodes.
- TransparentBackgroundUltra node add new model support. Please download the model file according to the instructions.
- Commit SegformerUltraV2, SegfromerFashionPipeline and SegformerClothesPipeline nodes, used for segmentation of clothing. please download the model file according to the instructions.
- Commit
install_requirements.bat
andinstall_requirements_aki.bat
, One click solution to install dependency packages. - Commit TransparentBackgroundUltra node, it remove background based on transparent-background model.
- Change the VitMatte model of the Ultra node to a local call. Please download all files of vitmatte model to the
ComfyUI/models/vitmatte
folder. - GetColorToneV2 node add the
mask
method to the color selection option, which can accurately obtain the main color and average color within the mask. - ImageScaleByAspectRatioV2 node add the "background_color" option.
- LUT Apply Add the "strength" option.
- Commit AutoAdjustV2 node, add optional mask input and support for multiple automatic color adjustment modes.
- Due to the upcoming discontinuation of gemini-pro vision services, PromptTagger and PromptEmbellish have added the "gemini-1.5-flash" API to continue using it.
- Ultra nodes added the option to run
VitMatte
on the CUDA device, resulting in a 5-fold increase in running speed. - Commit QueueStop node, used to terminate the queue operation.
- Optimize performance of the
VitMate
method for Ultra nodes when processing large-size image. - CropByMaskV2 add option to round the cutting size by multiples.
- Commit CheckMask node, it detect whether the mask contains sufficient effective areas. Commit HSVValue node, it convert color values to HSV values.
- BooleanOperatorV2, NumberCalculatorV2, Integer, Float, Boolean nodes add string output to output the value as a string for use with SwitchCase.
- Commit SwitchCase node, Switches the output based on the matching string. Can be used for any type of data switching.
- Commit String node, Used to output a string. It is the TextBox simplified node.
- Commit If node,Switches output based on Boolean conditional input. Can be used for any type of data switching.
- Commit StringCondition node, Determines whether the text contains or does not contain a substring.
- Commit NumberCalculatorV2 node,Add the nth root operation. Commit BooleanOperatorV2 node, Increasing greater/less than, greater/less then or equal logical judgment. The two nodes can access numeric inputs and can input numeric values within the node. Note: Numeric input takes precedence. Values in nodes will not be valid when there is input.
- Commit SD3NegativeConditioning node, Encapsulate the four nodes of Negative Condition in SD3 into a separate node.
- ImageRemoveAlpha node add optional mask input.
- Commit HLFrequencyDetailRestore node, Using low-frequency filtering and high-frequency preserving to restore image details, the fusion is better.
- Commit AddGrain and MaskGrain nodes, Add noise to a picture or mask.
- Commit FilmV2 node, The fastgrain method is added on the basis of the previous one, and the noise generation speed is 10 times faster.
- Commit ImageToMask node, it can be converted image into 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.
- The blackpoint and whitepoint options in some nodes have been changed to slider adjustment for a more intuitive display. Include MaskEdgeUltraDetailV2, SegmentAnythingUltraV2, RmBgUltraV2,PersonMaskUltraV2,BiRefNetUltra, SegformerB2ClothesUltra, BlendIfMask and Levels.
- ImageScaleRestoreV2 and ImageScaleByAspectRatioV2 nodes add the
total_pixel
method to scale images. - Commit MediapipeFacialSegment node,Used to segment facial features, including left and right eyebrows, eyes, lips, and teeth.
- Commit BatchSelector node,Used to retrieve specified images or masks from batch images or masks.
- LayerUtility creates new subdirectories such as SystemIO, Data, and Prompt. Some nodes are classified into subdirectories.
- Commit MaskByColor node, Generate a mask based on the selected color.
- Commit LoadPSD node, It read the psd format, and output layer images. Note that this node requires the installation of the
psd_tools
dependency package, If error occurs during the installation of psd_tool, such asModuleNotFoundError: No module named 'docopt'
, please download docopt's whl and manual install it. - Commit SegformerB2ClothesUltra node, it used to segment character clothing. The model segmentation code is fromStartHua, thanks to the original author.
- SaveImagePlus node adds the output workflow to the json function, supports
%date
and%time
to embeddint date or time to path and filename, and adds the preview switch. - Commit SaveImagePlus node,It 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.
- Commit AddBlindWaterMark, ShowBlindWaterMark nodes, Add invisible watermark and decoded watermark to the picture. Commit CreateQRCode, DecodeQRCode nodes, It can generate two-dimensional code pictures and decode two-dimensional codes.
- ImageScaleRestoreV2, ImageScaleByAspectRatioV2, ImageAutoCropV2 nodes add options for
width
andheight
, which can specify width or height as fixed values. - Commit PurgeVRAM node, Clean up VRAM an RAM.
- Commit AutoAdjust node, it can automatically adjust image contrast and white balance.
- Commit RGBValue node to output the color value as a single decimal value of R, G, B. This idea is from vxinhao, Thanks.
- Commit seed node to output the seed value. The ImageMaskScaleAs, ImageScaleBySpectRatio, ImageScaleBySpectRatioV2, ImageScaleRestore, ImageScaleRestoreV2 nodes increase
width
,height
output. - Commit Levels node, it can achieve the same color levels adjustment function as Photoshop.Sharp&Soft add the "None" option.
- Commit BlendIfMask node, This node cooperates with ImgaeBlendV2 or ImageBlendAdvanceV2 to achieve the same Blend If function as Photoshop.
- Commit ColorTemperature and ColorBalance nodes, used to adjust the color temperature and color balance of the picture.
- Add new types of Blend Mode V2 between images. now supports up to 30 blend modes. The new blend mode is available for all V2 versions that support mixed mode nodes, including ImageBlend V2, ImageBlendAdvance V2, DropShadow V2, InnerShadow V2, OuterGlow V2, InnerGlow V2, Stroke V2, ColorOverlay V2, GradientOverlay V2.
Part of the code for BlendMode V2 is from Virtuoso Nodes for ComfyUI. Thanks to the original authors. - Commit YoloV8Detect node.
- Commit QWenImage2Prompt node, this node is repackage of the ComfyUI_VLM_nodes's
UForm-Gen2 Qwen Node
, thanks to the original author. - Commit BooleanOperator, NumberCalculator, TextBox, Integer, Float, Booleannodes. These nodes can perform mathematical and logical operations.
- Commit ExtendCanvasV2 node,support color value input.
- Commit AutoBrightness node,it can automatically adjust the brightness of image.
- CreateGradientMask node add
center
option. - Commit GetColorToneV2 node, can select the main and average colors for the background or body.
- Commit ImageRewardFilter node, can filter out poor quality pictures.
- Ultra nodes add
VITMatte(local)
method, You can choose this method to avoid accessing huggingface.co if you have already downloaded the model before. - Commit HDR Effect node,it enhances the dynamic range and visual appeal of input images. this node is repackage of HDR Effects (SuperBeasts.AI).
- Commit CropBoxResolve node.
- Commit BiRefNetUltra node, it using the BiRefNet model to remove background has better recognition ability and ultra-high edge details.
- Commit ImageAutoCropV2 node, it can choose not to remove the background, support mask input, and scale by long or short side size.
- Commit ImageHub node, supports up to 9 sets of Image and Mask switching output, and supports random output.
- Commit TextJoin node.
- Commit PromptEmbellish node. it output polished prompt words, and support inputting images as references.
- Ultra nodes have been fully upgraded to V2 version, with the addition of VITMatte edge processing method, which is suitable for handling semi transparent areas. Include MaskEdgeUltraDetailV2, SegmentAnythingUltraV2, RmBgUltraV2 and PersonMaskUltraV2 nodes.
- Commit Color of Shadow & Highlight node, it can adjust the color of