add info output of PrintInfo node

This commit is contained in:
chflame
2024-04-20 21:07:59 +08:00
parent 4808f00667
commit 52d5e32736
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ Node options:
* LUT<sup>*</sup>: 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.
<sup>*</sup>LUT folder is defined in resource_dir.ini, this file is located in the root directory of the plugin.
<sup>*</sup>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.
+4
View File
@@ -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')))
+3 -3
View File
@@ -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