added node GetImagesFromBatchRanged

This commit is contained in:
Flow-two
2025-03-27 02:29:14 +09:00
parent 43f27f5fa7
commit 0e4b11f628
3 changed files with 30 additions and 5 deletions
+4 -2
View File
@@ -5,9 +5,11 @@ __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
WEB_DIRECTORY = "./web"
NODE_CLASS_MAPPINGS = {
"WanImageToVideo_F2": WanImageToVideo_F2,
"WanImageToVideo_F2": WanImageToVideo_F2,
"GetImagesFromBatchRanged_F2": GetImagesFromBatchRanged_F2
}
NODE_DISPLAY_NAME_MAPPINGS = {
"WanImageToVideo_F2": "WanImageToVideo (Flow2)",
"WanImageToVideo_F2": "WanImageToVideo (Flow2)",
"GetImagesFromBatchRanged_F2": "Get Images From Batch Ranged"
}
+25 -2
View File
@@ -166,10 +166,11 @@ class WanImageToVideo_F2:
vae.first_stage_model.encode = WanVaeWrapper_F2(vae.first_stage_model, end_image).encode
la = vae.encode(concatenated)
print(1 + bool(valid_end_image))
latent = torch.zeros([1, 16, ((length - 1) // 4) + (1 + bool(valid_end_image)), height // 8, width // 8], device=device)
mask = torch.ones((1, 1, latent.shape[2], la.shape[-2], la.shape[-1]), device=device)
mask[:, :, :1] = 0.0
if valid_end_image:
mask[:, :, -1:] = 0.0
@@ -183,4 +184,26 @@ class WanImageToVideo_F2:
out_latent = {}
out_latent["samples"] = latent
return (positive, negative, out_latent)
return (positive, negative, out_latent)
class GetImagesFromBatchRanged_F2:
@classmethod
def INPUT_TYPES(s):
return {"required": {"images": ("IMAGE", ),
"start_percent": ("FLOAT", {"default": 0.00, "min": 0.00, "max": 1.00, "step": 0.01, "round": 0.01}),
"end_percent": ("FLOAT", {"default": 1.00, "min": 0.00, "max": 1.00, "step": 0.01, "round": 0.01}),
}}
RETURN_TYPES = ("IMAGE", )
FUNCTION = "range"
CATEGORY = "Flow2/Wan 2.1"
def range(self, images, start_percent, end_percent):
count = len(images)
start_index = round(count * start_percent)
end_index = round(count * end_percent)
images = images[start_index:end_index]
return (images, )
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "ComfyUI-WanStartEndFramesNative"
description = "Start and end frames video generation node that supports native ComfyUI."
version = "1.0.0"
version = "1.0.1"
license = {file = "LICENSE"}
dependencies = []