mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-07 10:47:58 +08:00
Compare commits
3 Commits
alexis/spl
...
range-type
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ff57addaa | |||
| 4a8ada2d15 | |||
| 8822627a60 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,5 +21,6 @@ venv*/
|
||||
*.log
|
||||
web_custom_versions/
|
||||
.DS_Store
|
||||
openapi.yaml
|
||||
filtered-openapi.yaml
|
||||
uv.lock
|
||||
|
||||
@ -185,36 +185,6 @@ class SplitImageWithAlpha(io.ComfyNode):
|
||||
return io.NodeOutput(torch.stack(out_images), 1.0 - torch.stack(out_alphas))
|
||||
|
||||
|
||||
class SplitImageChannels(io.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return io.Schema(
|
||||
node_id="SplitImageChannels",
|
||||
search_aliases=["convert to grayscale", "extract channels", "grayscale", "split channels", "RGB channels"],
|
||||
display_name="Split Image Channels",
|
||||
category="mask/compositing",
|
||||
inputs=[
|
||||
io.Image.Input("image"),
|
||||
],
|
||||
outputs=[
|
||||
io.Image.Output(display_name="red"),
|
||||
io.Image.Output(display_name="green"),
|
||||
io.Image.Output(display_name="blue"),
|
||||
io.Mask.Output(display_name="alpha")
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, image: torch.Tensor) -> io.NodeOutput:
|
||||
images = [i[:,:,:3] for i in image]
|
||||
stacked = torch.stack(images)
|
||||
reds = stacked[:, :, :, 0:1].repeat(1, 1, 1, 3)
|
||||
greens = stacked[:, :, :, 1:2].repeat(1, 1, 1, 3)
|
||||
blues = stacked[:, :, :, 2:3].repeat(1, 1, 1, 3)
|
||||
alphas = [i[:,:,3] if i.shape[2] > 3 else torch.ones_like(i[:,:,0]) for i in image]
|
||||
return io.NodeOutput(reds, greens, blues, 1.0 - torch.stack(alphas))
|
||||
|
||||
|
||||
class JoinImageWithAlpha(io.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
@ -247,7 +217,6 @@ class CompositingExtension(ComfyExtension):
|
||||
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||
return [
|
||||
PorterDuffImageComposite,
|
||||
SplitImageChannels,
|
||||
SplitImageWithAlpha,
|
||||
JoinImageWithAlpha,
|
||||
]
|
||||
|
||||
3231
openapi.yaml
3231
openapi.yaml
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user