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
b2e1744a
"include/ck/utility/amd_buffer_addressing.hpp" did not exist on "6fe3627a9eb35f1237266f1b6cc8fd3456aed67d"
Commit
b2e1744a
authored
Mar 04, 2024
by
comfyanonymous
Browse files
Add a ThresholdMask node.
parent
0db3111b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
comfy_extras/nodes_mask.py
comfy_extras/nodes_mask.py
+19
-0
No files found.
comfy_extras/nodes_mask.py
View file @
b2e1744a
...
...
@@ -341,6 +341,24 @@ class GrowMask:
out
.
append
(
output
)
return
(
torch
.
stack
(
out
,
dim
=
0
),)
class
ThresholdMask
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"mask"
:
(
"MASK"
,),
"value"
:
(
"FLOAT"
,
{
"default"
:
0.5
,
"min"
:
0.0
,
"max"
:
1.0
,
"step"
:
0.01
}),
}
}
CATEGORY
=
"mask"
RETURN_TYPES
=
(
"MASK"
,)
FUNCTION
=
"image_to_mask"
def
image_to_mask
(
self
,
mask
,
value
):
mask
=
(
mask
>
value
).
float
()
return
(
mask
,)
NODE_CLASS_MAPPINGS
=
{
...
...
@@ -355,6 +373,7 @@ NODE_CLASS_MAPPINGS = {
"MaskComposite"
:
MaskComposite
,
"FeatherMask"
:
FeatherMask
,
"GrowMask"
:
GrowMask
,
"ThresholdMask"
:
ThresholdMask
,
}
NODE_DISPLAY_NAME_MAPPINGS
=
{
...
...
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