From 23c8a7440c0504dcc389c4be5f58c7af05bb9764 Mon Sep 17 00:00:00 2001 From: "Lex Darlog (DRL)" <3897975+Lex-DRL@users.noreply.github.com> Date: Sat, 19 Jul 2025 09:56:41 +0500 Subject: [PATCH] + output raw upscale value in the upscale node --- _funcs.py | 9 ++++----- nodes_upscale.py | 14 ++------------ return_tuples.py | 1 - 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/_funcs.py b/_funcs.py index 7b73c9d..13c75d9 100644 --- a/_funcs.py +++ b/_funcs.py @@ -228,10 +228,7 @@ def upscale_result_from_approx_wh( float(up_width) / upscale, float(up_height) / upscale, step ) - needs_resize, real_upscale_avg, real_upscale_x, real_upscale_y = _need_post_resize(width, height, up_width, up_height) - out_upscale: float = upscale if needs_resize else real_upscale_avg - - result = ResultUpscaled(out_upscale, width, height, up_width, up_height, needs_resize) + result = ResultUpscaled(upscale, width, height, up_width, up_height) if not unique_id: return result @@ -250,12 +247,14 @@ def upscale_result_from_approx_wh( f"{prefix}{x}" for x in cur_report.split('\n') )) + needs_resize, real_upscale_avg, real_upscale_x, real_upscale_y = _need_post_resize(width, height, up_width, up_height) + separator_line: str = ( # Real upscale factor in X and Y differ enough so we can't get the up-res from init-res with ANY uniform value: f"\n--- ⚠️ x{real_upscale_x:.3f} / x{real_upscale_y:.3f} ---\n" if needs_resize # The upscale is uniform: - else f"\n--- x{real_upscale_x:.3f} ---\n" + else f"\n--- x{real_upscale_avg:.3f} ---\n" ) text = separator_line.join(report_parts) diff --git a/nodes_upscale.py b/nodes_upscale.py index ce9fd77..52d0e37 100644 --- a/nodes_upscale.py +++ b/nodes_upscale.py @@ -30,23 +30,13 @@ from .slot_types import ( # ---------------------------------------------------------- -_return_types_upscale = (_IO.FLOAT, _IO.INT, _IO.INT, _IO.INT, _IO.INT, _IO.BOOLEAN) +_return_types_upscale = (_IO.FLOAT, _IO.INT, _IO.INT, _IO.INT, _IO.INT) _return_ttips_upscale = _frozendict({ - 'upscale': ( - "If 'needs_resize' is FALSE, this would be the actual uniform value to scale your initial-res in order " - "to get the upscaled-res.\n" - "If 'needs_resize' is TRUE, this slot simply outputs the same upscale-value you've set on the node." - ), + 'upscale': "Simply outputs the same upscale-value you've set on the node.", 'orig_w': "Width for original/initial image", 'orig_h': "Height for original/initial image", 'up_w': "Width for the (main) upscaled image", 'up_h': "Height for the (main) upscaled image", - 'needs_resize': ( - "This will be FALSE if you can get the exact upscaled resolution by simply scaling the initial-res uniformly " - "(by the value output into 'upscale' slot).\n\n" - "Otherwise, it will be TRUE — indicating that you'll need to do some cropping/out-painting right AFTER " - "the actual upscale (increasing the resolution itself) but BEFORE post-upscale sampling (\"HD-fix\")." - ), }) __extra_inputs_for_upscale_only = { diff --git a/return_tuples.py b/return_tuples.py index 20915b5..f8d1e3f 100644 --- a/return_tuples.py +++ b/return_tuples.py @@ -19,7 +19,6 @@ class ResultUpscaled(_t.NamedTuple): orig_height: int up_width: int up_height: int - needs_resize: bool class ResultUpscaledCropPad(_t.NamedTuple):