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
27b87c25
Commit
27b87c25
authored
Aug 15, 2023
by
comfyanonymous
Browse files
Add an EmptyImage node.
TODO: implement color picker in the frontend.
parent
6dc02c7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
nodes.py
nodes.py
+23
-0
No files found.
nodes.py
View file @
27b87c25
...
...
@@ -1465,6 +1465,28 @@ class ImageBatch:
s
=
torch
.
cat
((
image1
,
image2
),
dim
=
0
)
return
(
s
,)
class
EmptyImage
:
def
__init__
(
self
,
device
=
"cpu"
):
self
.
device
=
device
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"width"
:
(
"INT"
,
{
"default"
:
512
,
"min"
:
1
,
"max"
:
MAX_RESOLUTION
,
"step"
:
1
}),
"height"
:
(
"INT"
,
{
"default"
:
512
,
"min"
:
1
,
"max"
:
MAX_RESOLUTION
,
"step"
:
1
}),
"batch_size"
:
(
"INT"
,
{
"default"
:
1
,
"min"
:
1
,
"max"
:
64
}),
"color"
:
(
"INT"
,
{
"default"
:
0
,
"min"
:
0
,
"max"
:
0xFFFFFF
,
"step"
:
1
,
"display"
:
"color"
}),
}}
RETURN_TYPES
=
(
"IMAGE"
,)
FUNCTION
=
"generate"
CATEGORY
=
"image"
def
generate
(
self
,
width
,
height
,
batch_size
=
1
,
color
=
0
):
r
=
torch
.
full
([
batch_size
,
height
,
width
,
1
],
((
color
>>
16
)
&
0xFF
)
/
0xFF
)
g
=
torch
.
full
([
batch_size
,
height
,
width
,
1
],
((
color
>>
8
)
&
0xFF
)
/
0xFF
)
b
=
torch
.
full
([
batch_size
,
height
,
width
,
1
],
((
color
)
&
0xFF
)
/
0xFF
)
return
(
torch
.
cat
((
r
,
g
,
b
),
dim
=-
1
),
)
class
ImagePadForOutpaint
:
@
classmethod
...
...
@@ -1551,6 +1573,7 @@ NODE_CLASS_MAPPINGS = {
"ImageInvert"
:
ImageInvert
,
"ImageBatch"
:
ImageBatch
,
"ImagePadForOutpaint"
:
ImagePadForOutpaint
,
"EmptyImage"
:
EmptyImage
,
"ConditioningAverage "
:
ConditioningAverage
,
"ConditioningCombine"
:
ConditioningCombine
,
"ConditioningConcat"
:
ConditioningConcat
,
...
...
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