Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nodes_advanced_refluxcontrol #251

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bizyair_extras/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .nodes_advanced_refluxcontrol import *
from .nodes_comfyui_instantid import *
from .nodes_comfyui_pulid_flux import *
from .nodes_controlnet import *
Expand Down
62 changes: 62 additions & 0 deletions bizyair_extras/nodes_advanced_refluxcontrol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""ComfyUI Advanced Redux Control
Reference: https://github.com/kaibioinfo/ComfyUI_AdvancedRefluxControl
"""

from bizyair import BizyAirBaseNode, data_types
from bizyair.path_utils import path_manager as folder_paths

STRENGTHS = ["highest", "high", "medium", "low", "lowest"]
STRENGTHS_VALUES = [1, 2, 3, 4, 5]
IMAGE_MODES = ["center crop (square)", "keep aspect ratio", "autocrop with mask"]


class StyleModelApplySimple(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"conditioning": (data_types.CONDITIONING,),
"style_model": (data_types.STYLE_MODEL,),
"clip_vision_output": ("CLIP_VISION_OUTPUT",),
"image_strength": (STRENGTHS, {"default": "medium"}),
}
}

RETURN_TYPES = (data_types.CONDITIONING,)
CATEGORY = "conditioning/style_model"
NODE_DISPLAY_NAME = "Apply style model (simple)"


class ReduxAdvanced(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"conditioning": (data_types.CONDITIONING,),
"style_model": (data_types.STYLE_MODEL,),
"clip_vision": ("CLIP_VISION",),
"image": ("IMAGE",),
"downsampling_factor": ("INT", {"default": 3, "min": 1, "max": 9}),
"downsampling_function": (
["nearest", "bilinear", "bicubic", "area", "nearest-exact"],
{"default": "area"},
),
"mode": (IMAGE_MODES, {"default": "center crop (square)"}),
"weight": (
"FLOAT",
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01},
),
},
"optional": {
"mask": ("MASK",),
"autocrop_margin": (
"FLOAT",
{"default": 0.1, "min": 0.0, "max": 1.0, "step": 0.01},
),
},
}

RETURN_TYPES = (data_types.CONDITIONING, "IMAGE", "MASK")
# FUNCTION = "apply_stylemodel"
NODE_DISPLAY_NAME = "Apply Redux model (advanced)"
CATEGORY = "conditioning/style_model"
2 changes: 1 addition & 1 deletion src/bizyair/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def is_image_tensor(tensor) -> bool:
def _(output, **kwargs):
if is_image_tensor(output) and not kwargs.get("disable_image_marker", False):
old_version = kwargs.get("old_version", False)
lossless = kwargs.get("lossless", False)
lossless = kwargs.get("lossless", True)
ccssu marked this conversation as resolved.
Show resolved Hide resolved
return IMAGE_MARKER + encode_comfy_image(
output, image_format="WEBP", old_version=old_version, lossless=lossless
)
Expand Down