Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
5f54614e
Commit
5f54614e
authored
Dec 20, 2023
by
comfyanonymous
Browse files
Add a RebatchImages node.
parent
e82942cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
comfy_extras/nodes_rebatch.py
comfy_extras/nodes_rebatch.py
+31
-1
No files found.
comfy_extras/nodes_rebatch.py
View file @
5f54614e
...
...
@@ -99,10 +99,40 @@ class LatentRebatch:
return
(
output_list
,)
class
ImageRebatch
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"images"
:
(
"IMAGE"
,),
"batch_size"
:
(
"INT"
,
{
"default"
:
1
,
"min"
:
1
,
"max"
:
4096
}),
}}
RETURN_TYPES
=
(
"IMAGE"
,)
INPUT_IS_LIST
=
True
OUTPUT_IS_LIST
=
(
True
,
)
FUNCTION
=
"rebatch"
CATEGORY
=
"image/batch"
def
rebatch
(
self
,
images
,
batch_size
):
batch_size
=
batch_size
[
0
]
output_list
=
[]
all_images
=
[]
for
img
in
images
:
for
i
in
range
(
img
.
shape
[
0
]):
all_images
.
append
(
img
[
i
:
i
+
1
])
for
i
in
range
(
0
,
len
(
all_images
),
batch_size
):
output_list
.
append
(
torch
.
cat
(
all_images
[
i
:
i
+
batch_size
],
dim
=
0
))
return
(
output_list
,)
NODE_CLASS_MAPPINGS
=
{
"RebatchLatents"
:
LatentRebatch
,
"RebatchImages"
:
ImageRebatch
,
}
NODE_DISPLAY_NAME_MAPPINGS
=
{
"RebatchLatents"
:
"Rebatch Latents"
,
}
\ No newline at end of file
"RebatchImages"
:
"Rebatch Images"
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment