From 52d5e327369d68c2f6bfce3c32f3764140242281 Mon Sep 17 00:00:00 2001 From: chflame Date: Sat, 20 Apr 2024 21:07:59 +0800 Subject: [PATCH] add info output of PrintInfo node --- README.MD | 2 +- py/imagefunc.py | 4 ++++ py/print_info.py | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index da791a8..2ae68c9 100644 --- a/README.MD +++ b/README.MD @@ -308,7 +308,7 @@ Node options: * LUT*: Here is a list of available. cube files in the LUT folder, and the selected LUT files will be applied to the image. * color_space: For regular image, please select linear, for image in the log color space, please select log. -*LUT folder is defined in resource_dir.ini, this file is located in the root directory of the plugin. +*LUT folder is defined in ```resource_dir.ini```, this file is located in the root directory of the plugin in. 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. diff --git a/py/imagefunc.py b/py/imagefunc.py index 2346ddc..2b63824 100644 --- a/py/imagefunc.py +++ b/py/imagefunc.py @@ -1225,6 +1225,10 @@ def mask_invert(mask:torch.Tensor) -> torch.Tensor: def subtract_mask(masks_a:torch.Tensor, masks_b:torch.Tensor) -> torch.Tensor: return torch.clamp(masks_a - masks_b, 0, 255) +def add_mask(masks_a:torch.Tensor, masks_b:torch.Tensor) -> torch.Tensor: + mask = chop_image(tensor2pil(masks_a), tensor2pil(masks_b), blend_mode='add', opacity=100) + return image2mask(mask) + def RGB2RGBA(image:Image, mask:Image) -> Image: (R, G, B) = image.convert('RGB').split() return Image.merge('RGBA', (R, G, B, mask.convert('L'))) diff --git a/py/print_info.py b/py/print_info.py index 8c36dfc..9f57d17 100644 --- a/py/print_info.py +++ b/py/print_info.py @@ -15,9 +15,9 @@ class PrintInfo: } CATEGORY = '😺dzNodes/LayerUtility' - RETURN_TYPES = () + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("info",) FUNCTION = "print_info" - OUTPUT_NODE = True def print_info(self, anything=None): value = f'PrintInfo: \n Input type = {type(anything)}' @@ -39,7 +39,7 @@ class PrintInfo: except Exception: value = 'source exists, but could not be serialized.' log(value) - return {"ui": {"text": (value,)}} + return (value,) NODE_CLASS_MAPPINGS = { "LayerUtility: PrintInfo": PrintInfo