mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-25 15:55:18 +00:00
Add ImageFromBatch.
This commit is contained in:
parent
cf4910a3a4
commit
0c9bc19768
@ -48,6 +48,25 @@ class RepeatImageBatch:
|
|||||||
s = image.repeat((amount, 1,1,1))
|
s = image.repeat((amount, 1,1,1))
|
||||||
return (s,)
|
return (s,)
|
||||||
|
|
||||||
|
class ImageFromBatch:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": { "image": ("IMAGE",),
|
||||||
|
"batch_index": ("INT", {"default": 0, "min": 0, "max": 63}),
|
||||||
|
"length": ("INT", {"default": 1, "min": 1, "max": 64}),
|
||||||
|
}}
|
||||||
|
RETURN_TYPES = ("IMAGE",)
|
||||||
|
FUNCTION = "frombatch"
|
||||||
|
|
||||||
|
CATEGORY = "image/batch"
|
||||||
|
|
||||||
|
def frombatch(self, image, batch_index, length):
|
||||||
|
s_in = image
|
||||||
|
batch_index = min(s_in.shape[0] - 1, batch_index)
|
||||||
|
length = min(s_in.shape[0] - batch_index, length)
|
||||||
|
s = s_in[batch_index:batch_index + length].clone()
|
||||||
|
return (s,)
|
||||||
|
|
||||||
class SaveAnimatedWEBP:
|
class SaveAnimatedWEBP:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.output_dir = folder_paths.get_output_directory()
|
self.output_dir = folder_paths.get_output_directory()
|
||||||
@ -170,6 +189,7 @@ class SaveAnimatedPNG:
|
|||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
"ImageCrop": ImageCrop,
|
"ImageCrop": ImageCrop,
|
||||||
"RepeatImageBatch": RepeatImageBatch,
|
"RepeatImageBatch": RepeatImageBatch,
|
||||||
|
"ImageFromBatch": ImageFromBatch,
|
||||||
"SaveAnimatedWEBP": SaveAnimatedWEBP,
|
"SaveAnimatedWEBP": SaveAnimatedWEBP,
|
||||||
"SaveAnimatedPNG": SaveAnimatedPNG,
|
"SaveAnimatedPNG": SaveAnimatedPNG,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user