From fa790603addfabc858c9aa57bbbee862f9e860a7 Mon Sep 17 00:00:00 2001 From: "Lex Darlog (DRL)" <3897975+Lex-DRL@users.noreply.github.com> Date: Sun, 20 Jul 2025 00:37:01 +0500 Subject: [PATCH] + change upscale-output value --- CHANGELOG.md | 1 + _funcs.py | 8 ++++---- nodes_upscale.py | 11 ++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4da1da8..2b40d45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - This `CHANGELOG.md` file. - Prim-node rename (class and internal name, too): `Upscale Strategy (Best-Res)` -> `Crop-Pad Strategy (Best-Res)` - Inputs/outputs for upscale-related nodes are renamed to be more intuitive. +- `Best-Res (area+scale)`: change (restore) the value returned by `upscale` output. # V1.1.0 diff --git a/_funcs.py b/_funcs.py index e171ee4..f701058 100644 --- a/_funcs.py +++ b/_funcs.py @@ -228,7 +228,9 @@ def upscale_result_from_approx_wh( float(hd_width) / upscale, float(hd_height) / upscale, step ) - result = ResultUpscaled(upscale, width, height, hd_width, hd_height) + needs_resize, real_upscale_avg, real_upscale_x, real_upscale_y = _need_post_resize(width, height, hd_width, hd_height) + + result = ResultUpscaled(upscale if needs_resize else real_upscale_avg, width, height, hd_width, hd_height) if not unique_id: return result @@ -247,14 +249,12 @@ 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, hd_width, hd_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_avg:.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 469fd0b..db56c9e 100644 --- a/nodes_upscale.py +++ b/nodes_upscale.py @@ -32,7 +32,16 @@ from .slot_types import ( _return_types_upscale = (_IO.FLOAT, _IO.INT, _IO.INT, _IO.INT, _IO.INT) _return_ttips_upscale = _frozendict({ - 'upscale': "Simply outputs the same upscale-value you've set on the node.", + 'upscale': ( + "If the HD resolution can be achieved by uniformly scaling the initial one " + "(there is \"✅\" and not \"⚠️\" in the upscale-line of the status message), " + "outputs this precise upscale-value (might be different from the one originally set on the node itself).\n\n" + "Otherwise, outputs the original upscale-value intact.\n" + "In this case, you shouldn't use it directly and instead should pass it " + "to the \"Upscaled Crop/Pad (Best-Res)\" node and use the upscale-output from it.\n\n" + "In both cases, it won't hurt to use the \"Upscaled Crop/Pad (Best-Res)\" node and just rely " + "on it's `do_crop` and `do_padding` toggle-outputs." + ), 'init_width': "Width for original/initial image", 'init_height': "Height for original/initial image", 'HD_width': "Width for the (main/upscaled) HD-image",