mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-09 21:04:41 +08:00
add color match str parameter
This commit is contained in:
parent
7ea33f68fc
commit
7191a1fbbb
@ -56,8 +56,10 @@ class ColorMatch:
|
|||||||
], {
|
], {
|
||||||
"default": 'mkl'
|
"default": 'mkl'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"optional": {
|
||||||
|
"strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CATEGORY = "KJNodes/image"
|
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:
|
try:
|
||||||
from color_matcher import ColorMatcher
|
from color_matcher import ColorMatcher
|
||||||
except:
|
except:
|
||||||
@ -105,6 +107,8 @@ https://github.com/hahnec/color-matcher/
|
|||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
print(f"Error occurred during transfer: {e}")
|
print(f"Error occurred during transfer: {e}")
|
||||||
break
|
break
|
||||||
|
# Apply the strength multiplier
|
||||||
|
image_result = image_target_np + strength * (image_result - image_target_np)
|
||||||
out.append(torch.from_numpy(image_result))
|
out.append(torch.from_numpy(image_result))
|
||||||
|
|
||||||
out = torch.stack(out, dim=0).to(torch.float32)
|
out = torch.stack(out, dim=0).to(torch.float32)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user