From 4cdc78a09392a46ce114a1047c4968da7e9635f8 Mon Sep 17 00:00:00 2001 From: AlekPet Date: Thu, 30 Jul 2026 18:39:23 +0300 Subject: [PATCH] update ColorCorrectNode + implemented the ability to use the Color Correct Node with video frames --- ExtrasNode/extras_node.py | 42 ++++++++++++++++++++++----------------- pyproject.toml | 2 +- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ExtrasNode/extras_node.py b/ExtrasNode/extras_node.py index cb0af9a..f2952be 100644 --- a/ExtrasNode/extras_node.py +++ b/ExtrasNode/extras_node.py @@ -20,7 +20,7 @@ class PreviewTextNode: RETURN_TYPES = ("STRING",) OUTPUT_NODE = True - DESCRIPTION = "The node displays the input text." + DESCRIPTION = "The node displays the input text." FUNCTION = "preview_text" CATEGORY = "AlekPet Nodes/extras" @@ -60,7 +60,7 @@ class HexToHueNode: "string_hue_norm", ) FUNCTION = "to_hue" - DESCRIPTION = "The node convert HEX color to HUE." + DESCRIPTION = "The node convert HEX color to HUE." CATEGORY = "AlekPet Nodes/extras" def to_hue(self, color_hex, unique_id): @@ -114,7 +114,7 @@ class ColorsCorrectNode: RETURN_TYPES = ("IMAGE",) FUNCTION = "correct" - DESCRIPTION = "Node for correcting image colors." + DESCRIPTION = "Node for correcting image colors." CATEGORY = "AlekPet Nodes/extras" @staticmethod @@ -204,23 +204,29 @@ class ColorsCorrectNode: gamma=1.0, hue_degrees=0.0, ): - i = 255.0 * image[0].cpu().numpy() - image = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) - if use_color: - image = ColorsCorrectNode.tint_image(image, hex_color) + processed_images = [] + for img in image: + i = 255.0 * img.cpu().numpy() + img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) - image = ColorsCorrectNode.adjust_brightness(image, brightness) - image = ColorsCorrectNode.adjust_contrast(image, contrast) - image = ColorsCorrectNode.adjust_saturation(image, saturation) - image = ColorsCorrectNode.adjust_gamma(image, gamma) + if use_color: + img = ColorsCorrectNode.tint_image(img, hex_color) - hue_norm = ColorsCorrectNode.degrees_to_hue(hue_degrees) - image = ColorsCorrectNode.adjust_hue(image, hue_norm) + img = ColorsCorrectNode.adjust_brightness(img, brightness) + img = ColorsCorrectNode.adjust_contrast(img, contrast) + img = ColorsCorrectNode.adjust_saturation(img, saturation) + img = ColorsCorrectNode.adjust_gamma(img, gamma) - image = ImageOps.exif_transpose(image) - image = image.convert("RGB") - image = np.array(image).astype(np.float32) / 255.0 - image = torch.from_numpy(image)[None,] + hue_norm = ColorsCorrectNode.degrees_to_hue(hue_degrees) + img = ColorsCorrectNode.adjust_hue(img, hue_norm) - return (image,) + img = ImageOps.exif_transpose(img) + img = img.convert("RGB") + img = np.array(img).astype(np.float32) / 255.0 + img = torch.from_numpy(img)[None,] + processed_images.append(img) + + output_batch = torch.cat(processed_images, dim=0) + + return (output_batch,) diff --git a/pyproject.toml b/pyproject.toml index 2c5c4f8..e8134a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_custom_nodes_alekpet" description = "Nodes: PoseNode, PainterNode, TranslateTextNode, TranslateCLIPTextEncodeNode, DeepTranslatorTextNode, DeepTranslatorCLIPTextEncodeNode, ArgosTranslateTextNode, ArgosTranslateCLIPTextEncodeNode, ChatGLM4TranslateCLIPTextEncodeNode, ChatGLM4TranslateTextNode, ChatGLM4InstructNode, ChatGLM4InstructMediaNode, ChatGLMImageGenerateNode, ChatGLMVideoGenerateNode, PreviewTextNode, HexToHueNode, ColorsCorrectNode, IDENode." -version = "1.1.7" +version = "1.1.8" license = { file = "LICENSE" } [project.urls]