commit GetMainColors and ColorName node, Duplicate Brightness & Contrast node as BrightnessContrastV2, and Color of Shadow & Highlight node as ColorofShadowHighlightV2

This commit is contained in:
chflame163
2024-09-15 00:03:38 +08:00
parent 1240cc657b
commit 15d3bb1fd9
17 changed files with 2471 additions and 16 deletions
+33 -1
View File
@@ -116,7 +116,8 @@ When this error has occurred, please check the network environment.
## Update
<font size="4">**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. </font><br />
* Commit [GetMainColors](#GetMainColors) node, it can obtained 5 main colors of image. Commit [ColorName](#ColorName) node, it can obtain the color name of input color value.
* Duplicate the [Brightness & Contrast](#Brightness) node as [BrightnessContrastV2](#BrightnessContrastV2), and the [Color of Shadow & Highlight](#Highlight) node as [ColorofShadowHighlight](#HighlightV2) to avoid errors in ComfyUI workflow parsing caused by the "&" character in the node name.
* Commit [VQAPrompt](#VQAPrompt) and [LoadVQAModel](#LoadVQAModel) nodes.
Download the model from [BaiduNetdisk](https://pan.baidu.com/s/1ILREVgM0eFJlkWaYlKsR0g?pwd=yw75) or [huggingface.co/Salesforce/blip-vqa-capfilt-large](https://huggingface.co/Salesforce/blip-vqa-capfilt-large/tree/main) and [huggingface.co/Salesforce/blip-vqa-base](https://huggingface.co/Salesforce/blip-vqa-base/tree/main) and copy to ```ComfyUI\models\VQA``` folder.
* [Florence2Ultra](#Florence2Ultra), [Florence2Image2Prompt](#Florence2Image2Prompt) 和 [LoadFlorence2Model](#LoadFlorence2Model) nodes support the MiaoshouAI/Florence-2-large-PromptGen-v1.5 and MiaoshouAI/Florence-2-base-PromptGen-v1.5 model.
@@ -503,6 +504,8 @@ Node options:
Node option:
* exposure: Exposure value. Higher values indicate brighter image.
### Color of Shadow <a id="table1">HighlightV2</a>
A replica of the ```Color of Shadow & Highlight``` node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors.
### <a id="table1">ColorTemperature</a>
![image](image/color_temperature_example.jpg)
@@ -554,6 +557,9 @@ Node options:
* contrast: Value of contrast.
* saturation: Value of saturation.
### <a id="table1">BrightnessContrastV2</a>
A replica of the ```Brightness & Contrast``` node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors.
### <a id="table1">RGB</a>
Adjust the RGB channels of the image.
@@ -971,6 +977,32 @@ Output:
* image: Solid color picture output, the size is the same as the input picture.
* mask: Mask output.
### <a id="table1">GetMainColors</a>
Obtain the main color of the image. You can obtain 5 colors.
![image](image/get_main_color_and_color_name_example.jpg)
![image](image/get_main_colors_example.jpg)
Node Options:
![image](image/get_main_color_node.jpg)
* image: The image input.
* k_means_algorithm:K-Means algorithm options. "lloyd" is the standard K-Means algorithm, while "elkan" is the triangle inequality algorithm, suitable for larger images.
Outputs:
* preview_image: 5 main color preview images.
* color_1~color_5: Color value output. Output an RGB string in HEX format.
### <a id="table1">ColorName</a>
Output the most similar color name in the color palette based on the color value.
![image](image/color_name_example.jpg)
Node Options:
![image](image/color_name_node.jpg)
* color: Color value input, in HEX format RGB string format.
* palette: Color palette. ```xkcd``` includes 949 colors, ```css3``` includes 147 colors, and ```html4``` includes 16 colors.
Output:
* color_name: Color name in string.
### <a id="table1">ExtendCanvas</a>
Extend the canvas
![image](image/extend_canvas_example.jpg)
+33
View File
@@ -116,6 +116,8 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
## 更新说明
<font size="4">**如果本插件更新后出现依赖包错误,请双击运行插件目录下的```install_requirements.bat```(官方便携包),或 ```install_requirements_aki.bat```(秋叶整合包) 重新安装依赖包。
* 添加 [GetMainColors](#GetMainColors) 节点,可获得图片的5个主要颜色。 添加 [ColorName](#ColorName) 节点,可获得颜色名称。
* 复制 [Brightness & Contrast](#Brightness) 节点为 [BrightnessContrastV2](#BrightnessContrastV2), [Color of Shadow & Highlight](#Highlight) 节点为 [ColorofShadowHighlight](#HighlightV2), 避免节点名称中的"&"字符造成ComfyUI工作流解析错误。
* 添加 [VQAPrompt](#VQAPrompt) 和 [LoadVQAModel](#LoadVQAModel) 节点。
请从[百度网盘](https://pan.baidu.com/s/1ILREVgM0eFJlkWaYlKsR0g?pwd=yw75) 或者 [huggingface.co/Salesforce/blip-vqa-capfilt-large](https://huggingface.co/Salesforce/blip-vqa-capfilt-large/tree/main) 和 [huggingface.co/Salesforce/blip-vqa-base](https://huggingface.co/Salesforce/blip-vqa-base/tree/main) 下载全部模型文件并放到 ```ComfyUI\models\VQA```文件夹。
* [Florence2Ultra](#Florence2Ultra), [Florence2Image2Prompt](#Florence2Image2Prompt) 和 [LoadFlorence2Model](#LoadFlorence2Model) 节点支持MiaoshouAI/Florence-2-large-PromptGen-v1.5 和 MiaoshouAI/Florence-2-base-PromptGen-v1.5 模型。
@@ -497,6 +499,9 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
* highlight_level_offset: 亮部取值的偏移量,更小的数值使更多靠近阴暗的区域纳入亮部。
* highlight_range: 亮部的过渡范围。
### Color of Shadow <a id="table1">HighlightV2</a>
Color of Shadow & Highlight 节点的复制品,去掉了节点名称中的"&"字符以避免ComfyUI工作流解析错误。
### <a id="table1">ColorTemperature</a>
![image](image/color_temperature_example.jpg)
改变图像的色温。
@@ -547,6 +552,8 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
* contrast: 图像的对比度。
* saturation: 图像的色彩饱和度。
### <a id="table1">BrightnessContrastV2</a>
```Brightness & Contrast```节点的复制品,去掉了节点名称中的"&"字符以避免ComfyUI工作流解析错误。
### <a id="table1">RGB</a>
对图像的RGB各通道进行调整。
@@ -956,6 +963,32 @@ GetColorTone的V2升级版。可以指定获取主体或背景的主色或平均
* image: 纯色图片输出, 尺寸与输入的图片相同。
* mask: 遮罩输出。
### <a id="table1">GetMainColors</a>
获得图片的主色。可获得5个颜色。
![image](image/get_main_color_and_color_name_example.jpg)
![image](image/get_main_colors_example.jpg)
节点选项:
![image](image/get_main_color_node.jpg)
* image: 图片输入。
* k_means_algorithm: K-Means 算法选项。 "lloyd" 为标准K-Means算法, "elkan" 为三角不等式算法,适合更大的图片。
输出:
* preview_image: 5个主色预览图片。
* color_1~color_5: 色值输出。输出格式为HEX格式的RGB字符串。
### <a id="table1">ColorName</a>
根据色值输出调色盘里最近似的颜色名称。
![image](image/color_name_example.jpg)
节点选项:
![image](image/color_name_node.jpg)
* color: 颜色色值输入,格式为HEX格式的RGB字符串。
* palette: 调色板。 ```xkcd```包括了949种颜色, ```css3```包括了147种颜色, ```html4```包括了16种颜色。
输出:
* color_name: 颜色名称,格式为字符串。
### <a id="table1">ExtendCanvas</a>
扩展画布。
![image](image/extend_canvas_example.jpg)
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 KiB

+56 -5
View File
@@ -1,11 +1,11 @@
from .imagefunc import *
NODE_NAME = 'Brightness & Contrast'
class ColorCorrectBrightnessAndContrast:
def __init__(self):
pass
self.NODE_NAME = 'Brightness & Contrast'
@classmethod
def INPUT_TYPES(self):
@@ -48,13 +48,64 @@ class ColorCorrectBrightnessAndContrast:
ret_image = RGB2RGBA(ret_image, __image.split()[-1])
ret_images.append(pil2tensor(ret_image))
log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
log(f"{self.NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)
# 节点名称去掉“&”
class LS_ColorCorrect_Brightness_And_Contrast_V2:
def __init__(self):
self.NODE_NAME = 'Brightness Contrast V2'
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"image": ("IMAGE", ), #
"brightness": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
"contrast": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
"saturation": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
},
"optional": {
}
}
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = 'color_correct_brightness_contrast_v2'
CATEGORY = '😺dzNodes/LayerColor'
def color_correct_brightness_contrast_v2(self, image, brightness, contrast, saturation):
ret_images = []
for i in image:
i = torch.unsqueeze(i,0)
__image = tensor2pil(i)
ret_image = __image.convert('RGB')
if brightness != 1:
brightness_image = ImageEnhance.Brightness(ret_image)
ret_image = brightness_image.enhance(factor=brightness)
if contrast != 1:
contrast_image = ImageEnhance.Contrast(ret_image)
ret_image = contrast_image.enhance(factor=contrast)
if saturation != 1:
color_image = ImageEnhance.Color(ret_image)
ret_image = color_image.enhance(factor=saturation)
if __image.mode == 'RGBA':
ret_image = RGB2RGBA(ret_image, __image.split()[-1])
ret_images.append(pil2tensor(ret_image))
log(f"{self.NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)
NODE_CLASS_MAPPINGS = {
"LayerColor: Brightness & Contrast": ColorCorrectBrightnessAndContrast
"LayerColor: Brightness & Contrast": ColorCorrectBrightnessAndContrast,
"LayerColor: BrightnessContrastV2": LS_ColorCorrect_Brightness_And_Contrast_V2
}
NODE_DISPLAY_NAME_MAPPINGS = {
"LayerColor: Brightness & Contrast": "LayerColor: Brightness & Contrast"
"LayerColor: BrightnessContrastV2": "LayerColor: Brightness Contrast V2"
}
+120 -4
View File
@@ -1,6 +1,6 @@
from .imagefunc import *
NODE_NAME = 'Color of Shadow & Highlight'
def norm_value(value):
if value < 0.01:
@@ -8,10 +8,11 @@ def norm_value(value):
if value > 0.99:
value = 0.99
return value
class ColorCorrectShadowAndHighlight:
def __init__(self):
pass
self.NODE_NAME = 'Color of Shadow & Highlight'
@classmethod
def INPUT_TYPES(self):
@@ -118,10 +119,125 @@ class ColorCorrectShadowAndHighlight:
log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)
# 名称去掉“&”
class LS_ColorCorrectShadow_And_Highlight_V2:
def __init__(self):
self.NODE_NAME = 'Color of Shadow & Highlight V2'
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"image": ("IMAGE", ),
"shadow_brightness": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
"shadow_saturation": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
"shadow_hue": ("INT", {"default": 0, "min": -255, "max": 255, "step": 1}),
"shadow_level_offset": ("INT", {"default": 0, "min": -99, "max": 99, "step": 1}),
"shadow_range": ("FLOAT", {"default": 0.25, "min": 0.01, "max": 0.99, "step": 0.01}),
"highlight_brightness": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
"highlight_saturation": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}),
"highlight_hue": ("INT", {"default": 0, "min": -255, "max": 255, "step": 1}),
"highlight_level_offset": ("INT", {"default": 0, "min": -99, "max": 99, "step": 1}),
"highlight_range": ("FLOAT", {"default": 0.25, "min": 0.01, "max": 0.99, "step": 0.01}),
},
"optional": {
"mask": ("MASK",), #
}
}
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = 'color_shadow_and_highlight_v2'
CATEGORY = '😺dzNodes/LayerColor'
def color_shadow_and_highlight_v2(self, image,
shadow_brightness, shadow_saturation,
shadow_level_offset, shadow_range, shadow_hue,
highlight_brightness, highlight_saturation, highlight_hue,
highlight_level_offset, highlight_range,
mask=None
):
ret_images = []
input_images = []
input_masks = []
for i in image:
input_images.append(torch.unsqueeze(i, 0))
m = tensor2pil(i)
if m.mode == 'RGBA':
input_masks.append(m.split()[-1])
else:
input_masks.append(Image.new('L', size=m.size, color='white'))
if mask is not None:
if mask.dim() == 2:
mask = torch.unsqueeze(mask, 0)
input_masks = []
for m in mask:
input_masks.append(tensor2pil(torch.unsqueeze(m, 0)).convert('L'))
max_batch = max(len(input_images), len(input_masks))
for i in range(max_batch):
_image = input_images[i] if i < len(input_images) else input_images[-1]
_image = tensor2pil(_image).convert('RGB')
_mask = input_masks[i] if i < len(input_masks) else input_masks[-1]
avg_gray = get_gray_average(_image, _mask)
shadow_level, highlight_level = calculate_shadow_highlight_level(avg_gray)
_canvas = _image.copy()
if shadow_saturation !=1 or shadow_brightness !=1 or shadow_hue:
shadow_low_threshold = (shadow_level + shadow_level_offset) / 100 + shadow_range / 2
shadow_low_threshold = norm_value(shadow_low_threshold)
shadow_high_threshold = (shadow_level + shadow_level_offset) / 100 - shadow_range / 2
shadow_high_threshold = norm_value(shadow_high_threshold)
_shadow_mask = luminance_keyer(_image, shadow_low_threshold, shadow_high_threshold)
_shadow = _image.copy()
if shadow_brightness != 1:
brightness_image = ImageEnhance.Brightness(_shadow)
_shadow = brightness_image.enhance(factor=shadow_brightness)
if shadow_saturation != 1:
color_image = ImageEnhance.Color(_shadow)
_shadow = color_image.enhance(factor=shadow_saturation)
if shadow_hue:
_h, _s, _v = _shadow.convert('HSV').split()
_h = image_hue_offset(_h, shadow_hue)
_shadow = image_channel_merge((_h, _s, _v), 'HSV')
_canvas.paste(_shadow, mask=gaussian_blur(_shadow_mask,(_shadow_mask.width + _shadow_mask.height)//800))
_canvas.paste(_image, mask=ImageChops.invert(_mask))
if highlight_saturation != 1 or highlight_brightness != 1 or highlight_hue:
highlight_low_threshold = (highlight_level + highlight_level_offset) / 100 - highlight_range / 2
highlight_low_threshold = norm_value(highlight_low_threshold)
highlight_high_threshold = (highlight_level + highlight_level_offset) / 100 + highlight_range / 2
highlight_high_threshold = norm_value(highlight_high_threshold)
_highlight_mask = luminance_keyer(_image, highlight_low_threshold, highlight_high_threshold)
_highlight = _image.copy()
if highlight_brightness != 1:
brightness_image = ImageEnhance.Brightness(_highlight)
_highlight = brightness_image.enhance(factor=highlight_brightness)
if highlight_saturation != 1:
color_image = ImageEnhance.Color(_highlight)
_highlight = color_image.enhance(factor=highlight_saturation)
if highlight_hue:
_h, _s, _v = _highlight.convert('HSV').split()
_h = image_hue_offset(_h, highlight_hue)
_highlight = image_channel_merge((_h, _s, _v), 'HSV')
_canvas.paste(_highlight, mask=gaussian_blur(_highlight_mask, (_highlight_mask.width + _highlight_mask.height)//800))
_canvas.paste(_image, mask=ImageChops.invert(_mask))
ret_images.append(pil2tensor(_canvas))
log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)
NODE_CLASS_MAPPINGS = {
"LayerColor: Color of Shadow & Highlight": ColorCorrectShadowAndHighlight
"LayerColor: Color of Shadow & Highlight": ColorCorrectShadowAndHighlight,
"LayerColor: ColorofShadowHighlightV2": LS_ColorCorrectShadow_And_Highlight_V2
}
NODE_DISPLAY_NAME_MAPPINGS = {
"LayerColor: Color of Shadow & Highlight": "LayerColor: Color of Shadow & Highlight"
"LayerColor: Color of Shadow & Highlight": "LayerColor: Color of Shadow & Highlight",
"LayerColor: ColorofShadowHighlightV2": "LayerColor: Colorof Shadow Highlight V2"
}
+1177
View File
File diff suppressed because it is too large Load Diff
+88
View File
@@ -0,0 +1,88 @@
from .imagefunc import *
any = AnyType("*")
class LS_GetMainColors:
def __init__(self):
self.NODE_NAME = 'Get Main Colors'
@classmethod
def INPUT_TYPES(self):
size_list = ['custom']
size_list.extend(load_custom_size())
k_means_algorithm_list = ["lloyd", "elkan"]
return {
"required": {
"image": ("IMAGE", ), #
"k_means_algorithm": (k_means_algorithm_list,),
},
"optional": {
}
}
RETURN_TYPES = ("IMAGE", "STRING", "STRING", "STRING", "STRING", "STRING",)
RETURN_NAMES = ("preview_image", "color_1", "color_2", "color_3", "color_4", "color_5",)
FUNCTION = 'get_main_colors'
CATEGORY = '😺dzNodes/LayerUtility'
def get_main_colors(self, image, k_means_algorithm):
ret_images = []
grid_width = 512
grid_height = 128
line_width = 5
for i in range(len(image)):
pil_img = tensor2pil(torch.unsqueeze(image[i], 0)).convert("RGB")
blured_image = gaussian_blur(pil_img, (pil_img.width + pil_img.height) // 400)
accuracy = 60 # Adjusts accuracy by changing number of iterations of the K-means algorithm
num_colors = 5
num_iterations = int(512 * (accuracy / 100))
original_colors = self.interrogate_colors(
pil2tensor(blured_image), num_colors=num_colors, algorithm=k_means_algorithm, mix_iter=num_iterations, random_state=0)
main_colors = self.ndarrays_to_colorhex(original_colors)
log(f"main_colors={main_colors}")
# draw colors image
ret_image = Image.new('RGB', size=(grid_width, grid_height * len(main_colors)), color="white")
draw = ImageDraw.Draw(ret_image)
for j in range(len(main_colors)):
x1 = 0
y1 = grid_height * j
draw.rectangle((x1, y1, x1 + grid_width, y1 + grid_height), fill=main_colors[j], outline=main_colors[j])
ret_images.append(pil2tensor(ret_image))
log(f"{self.NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0), main_colors[0], main_colors[1], main_colors[2], main_colors[3], main_colors[4],)
def ndarrays_to_colorhex(self, colors:list) -> list:
return [RGB_to_Hex((int(color[0]), int(color[1]), int(color[2]))) for color in colors]
def interrogate_colors(self, image:torch.Tensor, num_colors:int, algorithm:str, mix_iter:int, random_state:int) -> list:
from sklearn.cluster import KMeans
pixels = image.view(-1, image.shape[-1]).numpy()
colors = (
KMeans(
n_clusters=num_colors,
algorithm=algorithm,
max_iter=mix_iter,
random_state=random_state,
)
.fit(pixels)
.cluster_centers_
* 255
)
return colors
NODE_CLASS_MAPPINGS = {
"LayerUtility: GetMainColors": LS_GetMainColors
}
NODE_DISPLAY_NAME_MAPPINGS = {
"LayerUtility: GetMainColors": "LayerUtility: Get Main Colors"
}
+10 -3
View File
@@ -1722,7 +1722,6 @@ def mask_white_area(mask:Image, white_point:int) -> float:
'''Color Functions'''
def color_balance(image:Image, shadows:list, midtones:list, highlights:list,
shadow_center:float=0.15, midtone_center:float=0.5, highlight_center:float=0.8,
shadow_max:float=0.1, midtone_max:float=0.3, highlight_max:float=0.2,
@@ -1765,7 +1764,6 @@ def color_balance(image:Image, shadows:list, midtones:list, highlights:list,
return tensor2pil(img_copy)
def RGB_to_Hex(RGB:tuple) -> str:
color = '#'
for i in RGB:
@@ -1798,7 +1796,6 @@ def Hex_to_HSV_255level(inhex:str) -> list:
HSV = rgb_to_hsv(RGB[0] / 255.0, RGB[1] / 255.0, RGB[2] / 255.0)
return [int(x * 255) for x in HSV]
def HSV_255level_to_Hex(HSV: list) -> str:
if len(HSV) != 3 or any((not isinstance(v, int) or v < 0 or v > 255) for v in HSV):
raise ValueError('Invalid HSV values, each value should be an integer between 0 and 255')
@@ -1813,6 +1810,16 @@ def HSV_255level_to_Hex(HSV: list) -> str:
return '#' + hex_r + hex_g + hex_b
# 返回补色色值
def complementary_color(color: str) -> str:
color = Hex_to_RGB(color)
return RGB_to_Hex((255 - color[0], 255 - color[1], 255 - color[2]))
# 返回颜色对应灰度值
def rgb2gray(color:str)->int:
(r, g, b) = Hex_to_RGB(color)
return int((r * 299 + g * 587 + b * 114) / 1000)
'''Value Functions'''
def is_valid_mask(tensor:torch.Tensor) -> bool:
return not bool(torch.all(tensor == 0).item())
+1 -1
View File
@@ -20,7 +20,7 @@ class XYtoPercent:
}
RETURN_TYPES = ("FLOAT", "FLOAT",)
RETURN_NAMES = ("x_percent", "x_percent",)
RETURN_NAMES = ("x_percent", "y_percent",)
FUNCTION = 'xy_to_percent'
CATEGORY = '😺dzNodes/LayerUtility/Data'
+2 -2
View File
@@ -1,9 +1,9 @@
[project]
name = "comfyui_layerstyle"
description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress."
version = "1.0.55"
version = "1.0.56"
license = "MIT"
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime"]
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime"]
[project.urls]
Repository = "https://github.com/chflame163/ComfyUI_LayerStyle"
+1
View File
@@ -4,6 +4,7 @@ torch
matplotlib
Scipy
scikit_image
scikit_learn
opencv-contrib-python
pymatting
segment_anything
@@ -0,0 +1,488 @@
{
"last_node_id": 41,
"last_link_id": 61,
"nodes": [
{
"id": 17,
"type": "LayerUtility: GetMainColors",
"pos": {
"0": 660,
"1": 320
},
"size": {
"0": 311.9536437988281,
"1": 158
},
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 28
}
],
"outputs": [
{
"name": "preview_image",
"type": "IMAGE",
"links": [
46
],
"slot_index": 0,
"shape": 3
},
{
"name": "color_1",
"type": "STRING",
"links": [],
"slot_index": 1,
"shape": 3
},
{
"name": "color_2",
"type": "STRING",
"links": [
48,
55
],
"slot_index": 2,
"shape": 3
},
{
"name": "color_3",
"type": "STRING",
"links": [],
"slot_index": 3,
"shape": 3
},
{
"name": "color_4",
"type": "STRING",
"links": [],
"slot_index": 4,
"shape": 3
},
{
"name": "color_5",
"type": "STRING",
"links": [],
"slot_index": 5,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LayerUtility: GetMainColors"
},
"widgets_values": [
"lloyd"
],
"color": "rgba(38, 73, 116, 0.7)"
},
{
"id": 38,
"type": "LayerUtility: SimpleTextImage",
"pos": {
"0": 1400,
"1": 490
},
"size": [
333.2885159321711,
364.1828329417617
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "size_as",
"type": "*",
"link": 53
},
{
"name": "text",
"type": "STRING",
"link": 54,
"widget": {
"name": "text"
}
},
{
"name": "text_color",
"type": "STRING",
"link": 55,
"widget": {
"name": "text_color"
}
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
60
],
"shape": 3,
"slot_index": 0
},
{
"name": "mask",
"type": "MASK",
"links": null,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LayerUtility: SimpleTextImage"
},
"widgets_values": [
"text",
"Alibaba-PuHuiTi-Heavy.ttf",
"center",
80,
8,
400,
"#FFFFFF",
0,
"#FF8000",
0,
0,
512,
512
],
"color": "rgba(38, 73, 116, 0.7)"
},
{
"id": 40,
"type": "PreviewImage",
"pos": {
"0": 2160,
"1": 410
},
"size": [
697.0121532340336,
405.5093656051548
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 61
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 12,
"type": "LoadImage",
"pos": {
"0": 240,
"1": 420
},
"size": [
369.854603490381,
334.3001040695102
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
28,
53,
59
],
"slot_index": 0,
"shape": 3
},
{
"name": "MASK",
"type": "MASK",
"links": null,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"3840x2160car.jpg",
"image"
]
},
{
"id": 37,
"type": "PreviewImage",
"pos": {
"0": 660,
"1": 530
},
"size": [
313.2302664167988,
331.1310906195131
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 46
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 41,
"type": "LayerStyle: DropShadow V2",
"pos": {
"0": 1780,
"1": 490
},
"size": {
"0": 315,
"1": 266
},
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "background_image",
"type": "IMAGE",
"link": 59
},
{
"name": "layer_image",
"type": "IMAGE",
"link": 60
},
{
"name": "layer_mask",
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
61
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "LayerStyle: DropShadow V2"
},
"widgets_values": [
true,
"normal",
50,
25,
25,
6,
18,
"#000000"
],
"color": "rgba(20, 95, 121, 0.7)"
},
{
"id": 30,
"type": "ShowText|pysssss",
"pos": {
"0": 1410,
"1": 350
},
"size": [
320.67863272622117,
76
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "text",
"type": "STRING",
"link": 35,
"widget": {
"name": "text"
}
}
],
"outputs": [
{
"name": "STRING",
"type": "STRING",
"links": null,
"shape": 6
}
],
"properties": {
"Node name for S&R": "ShowText|pysssss"
},
"widgets_values": [
"",
"bubblegum pink"
]
},
{
"id": 25,
"type": "LayerUtility: ColorName",
"pos": {
"0": 1026,
"1": 354
},
"size": {
"0": 315,
"1": 82
},
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "color",
"type": "STRING",
"link": 48,
"widget": {
"name": "color"
}
}
],
"outputs": [
{
"name": "color_name",
"type": "STRING",
"links": [
35,
54
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LayerUtility: ColorName"
},
"widgets_values": [
"#000000",
"xkcd"
],
"color": "rgba(38, 73, 116, 0.7)"
}
],
"links": [
[
28,
12,
0,
17,
0,
"IMAGE"
],
[
35,
25,
0,
30,
0,
"STRING"
],
[
46,
17,
0,
37,
0,
"IMAGE"
],
[
48,
17,
2,
25,
0,
"STRING"
],
[
53,
12,
0,
38,
0,
"*"
],
[
54,
25,
0,
38,
1,
"STRING"
],
[
55,
17,
2,
38,
2,
"STRING"
],
[
59,
12,
0,
41,
0,
"IMAGE"
],
[
60,
38,
0,
41,
1,
"IMAGE"
],
[
61,
41,
0,
40,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.6830134553650709,
"offset": [
91.9153139552357,
304.8849710151086
]
}
},
"version": 0.4
}
+462
View File
@@ -0,0 +1,462 @@
{
"last_node_id": 55,
"last_link_id": 81,
"nodes": [
{
"id": 37,
"type": "PreviewImage",
"pos": {
"0": 660,
"1": 530
},
"size": [
313.2302664167988,
331.1310906195131
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 46
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 12,
"type": "LoadImage",
"pos": {
"0": 230,
"1": 420
},
"size": [
369.854603490381,
334.3001040695102
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
28
],
"slot_index": 0,
"shape": 3
},
{
"name": "MASK",
"type": "MASK",
"links": null,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"3840x2160car.jpg",
"image"
]
},
{
"id": 42,
"type": "LayerUtility: ColorImage V2",
"pos": {
"0": 1156,
"1": 166
},
"size": [
340.20001220703125,
130
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "size_as",
"type": "*",
"link": null
},
{
"name": "color",
"type": "STRING",
"link": 75,
"widget": {
"name": "color"
}
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
70
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "LayerUtility: ColorImage V2"
},
"widgets_values": [
"custom",
512,
512,
"#000000"
],
"color": "rgba(38, 73, 116, 0.7)"
},
{
"id": 47,
"type": "PreviewImage",
"pos": {
"0": 1578,
"1": 122
},
"size": [
210,
246
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 70
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 53,
"type": "PreviewImage",
"pos": {
"0": 1580,
"1": 420
},
"size": {
"0": 210,
"1": 246
},
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 77
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 52,
"type": "LayerUtility: ColorImage V2",
"pos": {
"0": 1150,
"1": 470
},
"size": {
"0": 340.20001220703125,
"1": 130
},
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "size_as",
"type": "*",
"link": null
},
{
"name": "color",
"type": "STRING",
"link": 78,
"widget": {
"name": "color"
}
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
77
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "LayerUtility: ColorImage V2"
},
"widgets_values": [
"custom",
512,
512,
"#000000"
],
"color": "rgba(38, 73, 116, 0.7)"
},
{
"id": 55,
"type": "PreviewImage",
"pos": {
"0": 1580,
"1": 730
},
"size": {
"0": 210,
"1": 246
},
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 80
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 54,
"type": "LayerUtility: ColorImage V2",
"pos": {
"0": 1150,
"1": 780
},
"size": {
"0": 340.20001220703125,
"1": 130
},
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "size_as",
"type": "*",
"link": null
},
{
"name": "color",
"type": "STRING",
"link": 81,
"widget": {
"name": "color"
}
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
80
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "LayerUtility: ColorImage V2"
},
"widgets_values": [
"custom",
512,
512,
"#000000"
],
"color": "rgba(38, 73, 116, 0.7)"
},
{
"id": 17,
"type": "LayerUtility: GetMainColors",
"pos": {
"0": 660,
"1": 320
},
"size": {
"0": 311.9536437988281,
"1": 158
},
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 28
}
],
"outputs": [
{
"name": "preview_image",
"type": "IMAGE",
"links": [
46
],
"slot_index": 0,
"shape": 3
},
{
"name": "color_1",
"type": "STRING",
"links": [
75
],
"slot_index": 1,
"shape": 3
},
{
"name": "color_2",
"type": "STRING",
"links": [
78
],
"slot_index": 2,
"shape": 3
},
{
"name": "color_3",
"type": "STRING",
"links": [
81
],
"slot_index": 3,
"shape": 3
},
{
"name": "color_4",
"type": "STRING",
"links": [],
"slot_index": 4,
"shape": 3
},
{
"name": "color_5",
"type": "STRING",
"links": [],
"slot_index": 5,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LayerUtility: GetMainColors"
},
"widgets_values": [
"lloyd"
],
"color": "rgba(38, 73, 116, 0.7)"
}
],
"links": [
[
28,
12,
0,
17,
0,
"IMAGE"
],
[
46,
17,
0,
37,
0,
"IMAGE"
],
[
70,
42,
0,
47,
0,
"IMAGE"
],
[
75,
17,
1,
42,
1,
"STRING"
],
[
77,
52,
0,
53,
0,
"IMAGE"
],
[
78,
17,
2,
52,
1,
"STRING"
],
[
80,
54,
0,
55,
0,
"IMAGE"
],
[
81,
17,
3,
54,
1,
"STRING"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9090909090909091,
"offset": [
45.96540063613157,
141.2842631072875
]
}
},
"version": 0.4
}