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
3ebf7452
Unverified
Commit
3ebf7452
authored
Mar 23, 2023
by
Guo Y.K
Browse files
nodes: add ImagePadForOutpaint
parent
dd095efc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
nodes.py
nodes.py
+40
-0
No files found.
nodes.py
View file @
3ebf7452
...
@@ -908,6 +908,45 @@ class ImageInvert:
...
@@ -908,6 +908,45 @@ class ImageInvert:
return
(
s
,)
return
(
s
,)
class
ImagePadForOutpaint
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"image"
:
(
"IMAGE"
,),
"left"
:
(
"INT"
,
{
"default"
:
0
,
"min"
:
0
,
"max"
:
4096
,
"step"
:
64
}),
"top"
:
(
"INT"
,
{
"default"
:
0
,
"min"
:
0
,
"max"
:
4096
,
"step"
:
64
}),
"right"
:
(
"INT"
,
{
"default"
:
0
,
"min"
:
0
,
"max"
:
4096
,
"step"
:
64
}),
"bottom"
:
(
"INT"
,
{
"default"
:
0
,
"min"
:
0
,
"max"
:
4096
,
"step"
:
64
}),
}
}
RETURN_TYPES
=
(
"IMAGE"
,
"MASK"
)
FUNCTION
=
"expand_image"
CATEGORY
=
"image"
def
expand_image
(
self
,
image
,
left
,
top
,
right
,
bottom
):
d1
,
d2
,
d3
,
d4
=
image
.
size
()
new_image
=
torch
.
zeros
(
(
d1
,
d2
+
top
+
bottom
,
d3
+
left
+
right
,
d4
),
dtype
=
torch
.
float32
,
)
new_image
[:,
top
:
top
+
d2
,
left
:
left
+
d3
,
:]
=
image
mask
=
torch
.
ones
(
(
d2
+
top
+
bottom
,
d3
+
left
+
right
),
dtype
=
torch
.
float32
,
)
mask
[
top
:
top
+
d2
,
left
:
left
+
d3
]
=
torch
.
zeros
(
(
d2
,
d3
),
dtype
=
torch
.
float32
,
)
return
(
new_image
,
mask
)
NODE_CLASS_MAPPINGS
=
{
NODE_CLASS_MAPPINGS
=
{
"KSampler"
:
KSampler
,
"KSampler"
:
KSampler
,
"CheckpointLoader"
:
CheckpointLoader
,
"CheckpointLoader"
:
CheckpointLoader
,
...
@@ -926,6 +965,7 @@ NODE_CLASS_MAPPINGS = {
...
@@ -926,6 +965,7 @@ NODE_CLASS_MAPPINGS = {
"LoadImageMask"
:
LoadImageMask
,
"LoadImageMask"
:
LoadImageMask
,
"ImageScale"
:
ImageScale
,
"ImageScale"
:
ImageScale
,
"ImageInvert"
:
ImageInvert
,
"ImageInvert"
:
ImageInvert
,
"ImagePadForOutpaint"
:
ImagePadForOutpaint
,
"ConditioningCombine"
:
ConditioningCombine
,
"ConditioningCombine"
:
ConditioningCombine
,
"ConditioningSetArea"
:
ConditioningSetArea
,
"ConditioningSetArea"
:
ConditioningSetArea
,
"KSamplerAdvanced"
:
KSamplerAdvanced
,
"KSamplerAdvanced"
:
KSamplerAdvanced
,
...
...
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