Skip to content

Commit

Permalink
Feature update color match default option (#76)
Browse files Browse the repository at this point in the history
* add tile size for VAE

* add tile size for VAE

* remove tile size for vae, add none option for colorMatching

* remove tile size for vae to switch back to regular tile size
  • Loading branch information
MaraScott committed Jun 13, 2024
1 parent f9c4dc8 commit f1db4f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions py/nodes/UpscalerRefiner/McBoaty_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class UpscalerRefiner_McBoaty_v3():
"SVD": 1024,
}
COLOR_MATCH_METHODS = [
'none',
'mkl',
'hm',
'reinhard',
Expand All @@ -65,7 +66,6 @@ def INPUT_TYPES(self):

"model": ("MODEL", { "label": "Model" }),
"vae": ("VAE", { "label": "VAE" }),
"vae_encode": ("BOOLEAN", { "label": "VAE Encode type", "default": True, "label_on": "tiled", "label_off": "standard"}),
"positive": ("CONDITIONING", { "label": "Positive" }),
"negative": ("CONDITIONING", { "label": "Negative" }),
"seed": ("INT", { "label": "Seed", "default": 4, "min": 0, "max": 0xffffffffffffffff}),
Expand All @@ -80,8 +80,9 @@ def INPUT_TYPES(self):
"denoise": ("FLOAT", { "label": "Denoise", "default": 0.35, "min": 0.0, "max": 1.0, "step": 0.01}),
"ays_model_type": (self.AYS_MODEL_TYPES, { "label": "Model Type" }),
"tile_size": ("INT", { "label": "Tile Size", "default": 512, "min": 320, "max": 4096, "step": 64}),
"vae_encode": ("BOOLEAN", { "label": "VAE Encode type", "default": True, "label_on": "tiled", "label_off": "standard"}),
"feather_mask": ("INT", { "label": "Feather Mask", "default": 64, "min": 32, "max": nodes.MAX_RESOLUTION, "step": 32}),
"color_match_method": (self.COLOR_MATCH_METHODS, { "label": "Color Match Method", "default": 'mkl'}),
"color_match_method": (self.COLOR_MATCH_METHODS, { "label": "Color Match Method", "default": 'none'}),

},
"optional": {
Expand Down Expand Up @@ -159,7 +160,7 @@ def init(self, **kwargs):
upscale_model_name = kwargs.get('upscale_model', None),
upscale_method = "lanczos",
feather_mask = kwargs.get('feather_mask', None),
color_match_method = kwargs.get('color_match_method', 'mkl'),
color_match_method = kwargs.get('color_match_method', 'none'),
max_iterations = kwargs.get('running_count', 1),
)
self.PARAMS.upscale_model = comfy_extras.nodes_upscale_model.UpscaleModelLoader().load_model(self.PARAMS.upscale_model_name)[0]
Expand Down Expand Up @@ -292,7 +293,8 @@ def upscale_refine(self, image, iteration):
upscaled_grid_specs = MS_Image().get_dynamic_grid_specs((image.shape[2]*self.PARAMS.upscale_model.scale), (image.shape[1]*self.PARAMS.upscale_model.scale), rows_qty, cols_qty, feather_mask)[0]
output_image, tiles_order = MS_Image().rebuild_image_from_parts(iteration, output_images, image, upscaled_grid_specs, feather_mask, self.PARAMS.upscale_model.scale)

output_image = ColorMatch().colormatch(image, output_image, self.PARAMS.color_match_method)[0]
if self.PARAMS.color_match_method != 'none':
output_image = ColorMatch().colormatch(image, output_image, self.PARAMS.color_match_method)[0]

tiles_order.sort(key=lambda x: x[0])
output_tiles = tuple(output for _, output in tiles_order)
Expand Down
2 changes: 1 addition & 1 deletion py/utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#
###

VERSION = "4.2.7"
VERSION = "4.2.8"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui_marascott_nodes"
description = "A set of nodes including a universal bus, an Inpainting By Mask and a large Upscaler/Refiner"
version = "4.2.7"
version = "4.2.8"
license = "LICENSE"
dependencies = ["blend_modes", "numba", "color-matcher"]

Expand Down

0 comments on commit f1db4f1

Please sign in to comment.