mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 19:22:32 +00:00
add an option to use old hiresfix width/height behavior
add a visual effect to inactive hires fix elements
This commit is contained in:
@@ -197,6 +197,15 @@ def restore_old_hires_fix_params(res):
|
||||
firstpass_width = res.get('First pass size-1', None)
|
||||
firstpass_height = res.get('First pass size-2', None)
|
||||
|
||||
if shared.opts.use_old_hires_fix_width_height:
|
||||
hires_width = int(res.get("Hires resize-1", None))
|
||||
hires_height = int(res.get("Hires resize-2", None))
|
||||
|
||||
if hires_width is not None and hires_height is not None:
|
||||
res['Size-1'] = hires_width
|
||||
res['Size-2'] = hires_height
|
||||
return
|
||||
|
||||
if firstpass_width is None or firstpass_height is None:
|
||||
return
|
||||
|
||||
@@ -205,12 +214,8 @@ def restore_old_hires_fix_params(res):
|
||||
height = int(res.get("Size-2", 512))
|
||||
|
||||
if firstpass_width == 0 or firstpass_height == 0:
|
||||
# old algorithm for auto-calculating first pass size
|
||||
desired_pixel_count = 512 * 512
|
||||
actual_pixel_count = width * height
|
||||
scale = math.sqrt(desired_pixel_count / actual_pixel_count)
|
||||
firstpass_width = math.ceil(scale * width / 64) * 64
|
||||
firstpass_height = math.ceil(scale * height / 64) * 64
|
||||
from modules import processing
|
||||
firstpass_width, firstpass_height = processing.old_hires_fix_first_pass_dimensions(width, height)
|
||||
|
||||
res['Size-1'] = firstpass_width
|
||||
res['Size-2'] = firstpass_height
|
||||
|
Reference in New Issue
Block a user