-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
142 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import random | ||
import folder_paths | ||
from nodes import SaveImage | ||
from comfy_extras.nodes_mask import ImageCompositeMasked | ||
import numpy as np | ||
|
||
|
||
class ImageAndMaskPreview2(SaveImage): | ||
def __init__(self): | ||
self.output_dir = folder_paths.get_temp_directory() | ||
self.type = "temp" | ||
self.prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5)) | ||
self.compress_level = 4 | ||
|
||
@classmethod | ||
def INPUT_TYPES(s): | ||
return { | ||
"required": { | ||
"mask_opacity": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), | ||
"mask_color": ("STRING", {"default": "255, 255, 255"}), | ||
"pass_through": ("BOOLEAN", {"default": False}), | ||
}, | ||
"optional": { | ||
"image": ("IMAGE",), | ||
"mask": ("MASK",), | ||
}, | ||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, | ||
} | ||
RETURN_TYPES = ("IMAGE",) | ||
RETURN_NAMES = ("composite",) | ||
FUNCTION = "execute" | ||
CATEGORY = "KJNodes" | ||
DESCRIPTION = """ | ||
Preview an image or a mask, when both inputs are used | ||
composites the mask on top of the image. | ||
with pass_through on the preview is disabled and the | ||
composite is returned from the composite slot instead, | ||
this allows for the preview to be passed for video combine | ||
nodes for example. | ||
""" | ||
|
||
def execute(self, mask_opacity, mask_color, pass_through, filename_prefix="ComfyUI", image=None, mask=None, prompt=None, extra_pnginfo=None): | ||
if mask is not None and image is None: | ||
preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3) | ||
elif mask is None and image is not None: | ||
preview = image | ||
elif mask is not None and image is not None: | ||
mask_adjusted = mask * mask_opacity | ||
mask_image = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3).clone() | ||
|
||
if ',' in mask_color: | ||
color_list = np.clip([int(channel) for channel in mask_color.split(',')], 0, 255) # RGB format | ||
else: | ||
mask_color = mask_color.lstrip('#') | ||
color_list = [int(mask_color[i:i+2], 16) for i in (0, 2, 4)] # Hex format | ||
mask_image[:, :, :, 0] = color_list[0] / 255 # Red channel | ||
mask_image[:, :, :, 1] = color_list[1] / 255 # Green channel | ||
mask_image[:, :, :, 2] = color_list[2] / 255 # Blue channel | ||
|
||
preview, = ImageCompositeMasked.composite(self, image, mask_image, 0, 0, True, mask_adjusted) | ||
if pass_through: | ||
return (preview, ) | ||
return(self.save_images(preview, filename_prefix, prompt, extra_pnginfo)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import torchaudio | ||
import torch | ||
import comfy.model_management | ||
import folder_paths | ||
import os | ||
import io | ||
import json | ||
import struct | ||
import random | ||
import hashlib | ||
from comfy.cli_args import args | ||
from comfy_extras.nodes_audio import SaveAudio | ||
|
||
class PreviewAudio2(SaveAudio): | ||
def __init__(self): | ||
self.output_dir = folder_paths.get_temp_directory() | ||
self.type = "temp" | ||
self.prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5)) | ||
|
||
@classmethod | ||
def INPUT_TYPES(s): | ||
return {"required": | ||
{"audio": ("AUDIO", ), }, | ||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { app } from "../../../scripts/app.js"; | ||
|
||
app.registerExtension({ | ||
name: "Yvann.appearance", // Extension name | ||
async nodeCreated(node) { | ||
if (node.comfyClass.endsWith("Yvann")) { | ||
// Apply styling | ||
node.color = "#153a61"; | ||
node.bgcolor = "#1A4870"; | ||
|
||
|
||
} | ||
} | ||
}); | ||
|
||
//#51829B bleu fonce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters