mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-09 21:04:41 +08:00
Add image remap node
This commit is contained in:
parent
7602d1e134
commit
788bb7936a
28
nodes.py
28
nodes.py
@ -2733,6 +2733,28 @@ class GenerateNoise:
|
||||
noise = noise[0].repeat(batch_size, 1, 1, 1)
|
||||
return ({"samples":noise}, )
|
||||
|
||||
class RemapDepth:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"image": ("IMAGE",),
|
||||
"min": ("FLOAT", {"default": 0.0,"min": -10.0, "max": 1.0, "step": 0.01}),
|
||||
"max": ("FLOAT", {"default": 1.0,"min": 0.0, "max": 10.0, "step": 0.01}),
|
||||
"clamp": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
FUNCTION = "remap"
|
||||
|
||||
CATEGORY = "KJNodes/noise"
|
||||
|
||||
def remap(self, image, min, max, clamp):
|
||||
|
||||
image = min + image * (max - min)
|
||||
if clamp:
|
||||
image = torch.clamp(image, min=0.0, max=1.0)
|
||||
return (image, )
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"INTConstant": INTConstant,
|
||||
@ -2785,7 +2807,8 @@ NODE_CLASS_MAPPINGS = {
|
||||
"AddLabel": AddLabel,
|
||||
"ReferenceOnlySimple3": ReferenceOnlySimple3,
|
||||
"SoundReactive": SoundReactive,
|
||||
"GenerateNoise": GenerateNoise
|
||||
"GenerateNoise": GenerateNoise,
|
||||
"RemapDepth": RemapDepth
|
||||
}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"INTConstant": "INT Constant",
|
||||
@ -2837,6 +2860,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"AddLabel": "AddLabel",
|
||||
"ReferenceOnlySimple3": "ReferenceOnlySimple3",
|
||||
"SoundReactive": "SoundReactive",
|
||||
"GenerateNoise": "GenerateNoise"
|
||||
"GenerateNoise": "GenerateNoise",
|
||||
"RemapDepth": "RemapDepth"
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user