mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-07-10 00:47:18 +08:00
Update nodes.py
This commit is contained in:
parent
1cbf8e5499
commit
5701e3f86f
36
nodes.py
36
nodes.py
@ -285,7 +285,7 @@ class CreateFadeMask:
|
|||||||
|
|
||||||
class CrossFadeImages:
|
class CrossFadeImages:
|
||||||
|
|
||||||
RETURN_TYPES = ("IMAGE",)
|
RETURN_TYPES = ("IMAGE", "IMAGE")
|
||||||
FUNCTION = "crossfadeimages"
|
FUNCTION = "crossfadeimages"
|
||||||
CATEGORY = "KJNodes"
|
CATEGORY = "KJNodes"
|
||||||
|
|
||||||
@ -362,8 +362,33 @@ class CrossFadeImages:
|
|||||||
# Append the beginning of images_1
|
# Append the beginning of images_1
|
||||||
beginning_images_1 = images_1[:transition_start_index]
|
beginning_images_1 = images_1[:transition_start_index]
|
||||||
crossfade_images = torch.cat([beginning_images_1, crossfade_images], dim=0)
|
crossfade_images = torch.cat([beginning_images_1, crossfade_images], dim=0)
|
||||||
return (crossfade_images,)
|
return (crossfade_images, )
|
||||||
|
|
||||||
|
class GetImageRangeFromBatch:
|
||||||
|
|
||||||
|
RETURN_TYPES = ("IMAGE",)
|
||||||
|
FUNCTION = "imagesfrombatch"
|
||||||
|
CATEGORY = "KJNodes"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"images": ("IMAGE",),
|
||||||
|
"start_index": ("INT", {"default": 1,"min": 0, "max": 4096, "step": 1}),
|
||||||
|
"num_frames": ("INT", {"default": 1,"min": 0, "max": 4096, "step": 1}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def imagesfrombatch(self, images, start_index, num_frames):
|
||||||
|
if start_index >= len(images):
|
||||||
|
raise ValueError("GetImageRangeFromBatch: Start index is out of range")
|
||||||
|
end_index = start_index + num_frames
|
||||||
|
if end_index > len(images):
|
||||||
|
raise ValueError("GetImageRangeFromBatch: End index is out of range")
|
||||||
|
chosen_images = images[start_index:end_index]
|
||||||
|
return (chosen_images, )
|
||||||
|
|
||||||
class CreateTextMask:
|
class CreateTextMask:
|
||||||
|
|
||||||
RETURN_TYPES = ("IMAGE", "MASK",)
|
RETURN_TYPES = ("IMAGE", "MASK",)
|
||||||
@ -876,7 +901,8 @@ class EmptyLatentImagePresets:
|
|||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"dimensions": (
|
"dimensions": (
|
||||||
[ '768 x 512',
|
[ '512 x 512',
|
||||||
|
'768 x 512',
|
||||||
'960 x 512',
|
'960 x 512',
|
||||||
'1024 x 512',
|
'1024 x 512',
|
||||||
'1536 x 640',
|
'1536 x 640',
|
||||||
@ -887,7 +913,7 @@ class EmptyLatentImagePresets:
|
|||||||
'1024 x 1024',
|
'1024 x 1024',
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
"default": '1024 x 1024'
|
"default": '512 x 512'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
"invert": ("BOOLEAN", {"default": False}),
|
"invert": ("BOOLEAN", {"default": False}),
|
||||||
@ -993,6 +1019,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"CrossFadeImages": CrossFadeImages,
|
"CrossFadeImages": CrossFadeImages,
|
||||||
"EmptyLatentImagePresets": EmptyLatentImagePresets,
|
"EmptyLatentImagePresets": EmptyLatentImagePresets,
|
||||||
"ColorMatch": ColorMatch,
|
"ColorMatch": ColorMatch,
|
||||||
|
"GetImageRangeFromBatch": GetImageRangeFromBatch
|
||||||
}
|
}
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
"INTConstant": "INT Constant",
|
"INTConstant": "INT Constant",
|
||||||
@ -1013,4 +1040,5 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
|||||||
"SomethingToString": "SomethingToString",
|
"SomethingToString": "SomethingToString",
|
||||||
"EmptyLatentImagePresets": "EmptyLatentImagePresets",
|
"EmptyLatentImagePresets": "EmptyLatentImagePresets",
|
||||||
"ColorMatch": "ColorMatch",
|
"ColorMatch": "ColorMatch",
|
||||||
|
"GetImageRangeFromBatch": "GetImageRangeFromBatch"
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user