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
c16f5744
Commit
c16f5744
authored
Oct 08, 2023
by
comfyanonymous
Browse files
Fix SplitImageWithAlpha and JoinImageWithAlpha.
parent
1f2f4eaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
comfy_extras/nodes_compositing.py
comfy_extras/nodes_compositing.py
+2
-2
No files found.
comfy_extras/nodes_compositing.py
View file @
c16f5744
...
...
@@ -158,7 +158,7 @@ class SplitImageWithAlpha:
def
split_image_with_alpha
(
self
,
image
:
torch
.
Tensor
):
out_images
=
[
i
[:,:,:
3
]
for
i
in
image
]
out_alphas
=
[
i
[:,:,
3
]
if
i
.
shape
[
2
]
>
3
else
torch
.
ones_like
(
i
[:,:,
0
])
for
i
in
image
]
result
=
(
torch
.
stack
(
out_images
),
torch
.
stack
(
out_alphas
))
result
=
(
torch
.
stack
(
out_images
),
1.0
-
torch
.
stack
(
out_alphas
))
return
result
...
...
@@ -180,7 +180,7 @@ class JoinImageWithAlpha:
batch_size
=
min
(
len
(
image
),
len
(
alpha
))
out_images
=
[]
alpha
=
resize_mask
(
alpha
,
image
.
shape
[
1
:])
alpha
=
1.0
-
resize_mask
(
alpha
,
image
.
shape
[
1
:])
for
i
in
range
(
batch_size
):
out_images
.
append
(
torch
.
cat
((
image
[
i
][:,:,:
3
],
alpha
[
i
].
unsqueeze
(
2
)),
dim
=
2
))
...
...
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