From 7191a1fbbb95f1346e6ad0345f245c2dcbce4aed Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Tue, 30 Jul 2024 16:08:59 +0300 Subject: [PATCH] add color match str parameter --- nodes/image_nodes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nodes/image_nodes.py b/nodes/image_nodes.py index 1fcc417..3996e51 100644 --- a/nodes/image_nodes.py +++ b/nodes/image_nodes.py @@ -56,8 +56,10 @@ class ColorMatch: ], { "default": 'mkl' }), - }, + "optional": { + "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}), + } } CATEGORY = "KJNodes/image" @@ -78,7 +80,7 @@ https://github.com/hahnec/color-matcher/ """ - def colormatch(self, image_ref, image_target, method): + def colormatch(self, image_ref, image_target, method, strength=1.0): try: from color_matcher import ColorMatcher except: @@ -105,6 +107,8 @@ https://github.com/hahnec/color-matcher/ except BaseException as e: print(f"Error occurred during transfer: {e}") break + # Apply the strength multiplier + image_result = image_target_np + strength * (image_result - image_target_np) out.append(torch.from_numpy(image_result)) out = torch.stack(out, dim=0).to(torch.float32)