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
0c9bc197
Commit
0c9bc197
authored
Feb 12, 2024
by
comfyanonymous
Browse files
Add ImageFromBatch.
parent
cf4910a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
comfy_extras/nodes_images.py
comfy_extras/nodes_images.py
+20
-0
No files found.
comfy_extras/nodes_images.py
View file @
0c9bc197
...
@@ -48,6 +48,25 @@ class RepeatImageBatch:
...
@@ -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:
...
@@ -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
,
}
}
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