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
9212bea8
"git@developer.sourcefind.cn:chenpangpang/ComfyUI.git" did not exist on "ac151ac1698624bc4e321addb8c126069aced4b0"
Commit
9212bea8
authored
Oct 04, 2023
by
comfyanonymous
Browse files
Change a few things in #1578.
parent
214ca719
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
30 deletions
+3
-30
comfy_extras/nodes_compositing.py
comfy_extras/nodes_compositing.py
+3
-3
nodes.py
nodes.py
+0
-27
No files found.
comfy_extras/nodes_compositing.py
View file @
9212bea8
...
@@ -102,7 +102,7 @@ class PorterDuffImageComposite:
...
@@ -102,7 +102,7 @@ class PorterDuffImageComposite:
RETURN_TYPES
=
(
"IMAGE"
,
"MASK"
)
RETURN_TYPES
=
(
"IMAGE"
,
"MASK"
)
FUNCTION
=
"composite"
FUNCTION
=
"composite"
CATEGORY
=
"compositing"
CATEGORY
=
"
mask/
compositing"
def
composite
(
self
,
source
:
torch
.
Tensor
,
source_alpha
:
torch
.
Tensor
,
destination
:
torch
.
Tensor
,
destination_alpha
:
torch
.
Tensor
,
mode
):
def
composite
(
self
,
source
:
torch
.
Tensor
,
source_alpha
:
torch
.
Tensor
,
destination
:
torch
.
Tensor
,
destination_alpha
:
torch
.
Tensor
,
mode
):
batch_size
=
min
(
len
(
source
),
len
(
source_alpha
),
len
(
destination
),
len
(
destination_alpha
))
batch_size
=
min
(
len
(
source
),
len
(
source_alpha
),
len
(
destination
),
len
(
destination_alpha
))
...
@@ -149,7 +149,7 @@ class SplitImageWithAlpha:
...
@@ -149,7 +149,7 @@ class SplitImageWithAlpha:
}
}
}
}
CATEGORY
=
"compositing"
CATEGORY
=
"
mask/
compositing"
RETURN_TYPES
=
(
"IMAGE"
,
"MASK"
)
RETURN_TYPES
=
(
"IMAGE"
,
"MASK"
)
FUNCTION
=
"split_image_with_alpha"
FUNCTION
=
"split_image_with_alpha"
...
@@ -170,7 +170,7 @@ class JoinImageWithAlpha:
...
@@ -170,7 +170,7 @@ class JoinImageWithAlpha:
}
}
}
}
CATEGORY
=
"compositing"
CATEGORY
=
"
mask/
compositing"
RETURN_TYPES
=
(
"IMAGE"
,)
RETURN_TYPES
=
(
"IMAGE"
,)
FUNCTION
=
"join_image_with_alpha"
FUNCTION
=
"join_image_with_alpha"
...
...
nodes.py
View file @
9212bea8
...
@@ -1372,31 +1372,6 @@ class LoadImage:
...
@@ -1372,31 +1372,6 @@ class LoadImage:
return
True
return
True
class
LoadImageWithAlpha
(
LoadImage
):
@
classmethod
def
INPUT_TYPES
(
s
):
input_dir
=
folder_paths
.
get_input_directory
()
files
=
[
f
for
f
in
os
.
listdir
(
input_dir
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
input_dir
,
f
))]
return
{
"required"
:
{
"image"
:
(
sorted
(
files
),
{
"image_upload"
:
True
})},
}
CATEGORY
=
"compositing"
RETURN_TYPES
=
(
"IMAGE"
,
"MASK"
)
FUNCTION
=
"load_image"
def
load_image
(
self
,
image
):
image_path
=
folder_paths
.
get_annotated_filepath
(
image
)
i
=
Image
.
open
(
image_path
)
i
=
ImageOps
.
exif_transpose
(
i
)
image
=
i
.
convert
(
"RGBA"
)
alpha
=
np
.
array
(
image
.
getchannel
(
"A"
)).
astype
(
np
.
float32
)
/
255.0
alpha
=
torch
.
from_numpy
(
alpha
)[
None
,]
image
=
np
.
array
(
image
).
astype
(
np
.
float32
)
/
255.0
image
=
torch
.
from_numpy
(
image
)[
None
,]
return
(
image
,
alpha
)
class
LoadImageMask
:
class
LoadImageMask
:
_color_channels
=
[
"alpha"
,
"red"
,
"green"
,
"blue"
]
_color_channels
=
[
"alpha"
,
"red"
,
"green"
,
"blue"
]
@
classmethod
@
classmethod
...
@@ -1631,7 +1606,6 @@ NODE_CLASS_MAPPINGS = {
...
@@ -1631,7 +1606,6 @@ NODE_CLASS_MAPPINGS = {
"SaveImage"
:
SaveImage
,
"SaveImage"
:
SaveImage
,
"PreviewImage"
:
PreviewImage
,
"PreviewImage"
:
PreviewImage
,
"LoadImage"
:
LoadImage
,
"LoadImage"
:
LoadImage
,
"LoadImageWithAlpha"
:
LoadImageWithAlpha
,
"LoadImageMask"
:
LoadImageMask
,
"LoadImageMask"
:
LoadImageMask
,
"ImageScale"
:
ImageScale
,
"ImageScale"
:
ImageScale
,
"ImageScaleBy"
:
ImageScaleBy
,
"ImageScaleBy"
:
ImageScaleBy
,
...
@@ -1728,7 +1702,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
...
@@ -1728,7 +1702,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"SaveImage"
:
"Save Image"
,
"SaveImage"
:
"Save Image"
,
"PreviewImage"
:
"Preview Image"
,
"PreviewImage"
:
"Preview Image"
,
"LoadImage"
:
"Load Image"
,
"LoadImage"
:
"Load Image"
,
"LoadImageWithAlpha"
:
"Load Image with Alpha"
,
"LoadImageMask"
:
"Load Image (as Mask)"
,
"LoadImageMask"
:
"Load Image (as Mask)"
,
"ImageScale"
:
"Upscale Image"
,
"ImageScale"
:
"Upscale Image"
,
"ImageScaleBy"
:
"Upscale Image By"
,
"ImageScaleBy"
:
"Upscale Image By"
,
...
...
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