mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-04-29 08:19:01 +08:00
extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed
This commit is contained in:
parent
0bb6e00ba3
commit
4a666381bf
@ -60,8 +60,10 @@ def run_postprocessing(extras_mode, image, image_folder, input_dir, output_dir,
|
|||||||
|
|
||||||
if opts.use_original_name_batch and name is not None:
|
if opts.use_original_name_batch and name is not None:
|
||||||
basename = os.path.splitext(os.path.basename(name))[0]
|
basename = os.path.splitext(os.path.basename(name))[0]
|
||||||
|
forced_filename = basename
|
||||||
else:
|
else:
|
||||||
basename = ''
|
basename = ''
|
||||||
|
forced_filename = None
|
||||||
|
|
||||||
infotext = ", ".join([k if k == v else f'{k}: {generation_parameters_copypaste.quote(v)}' for k, v in pp.info.items() if v is not None])
|
infotext = ", ".join([k if k == v else f'{k}: {generation_parameters_copypaste.quote(v)}' for k, v in pp.info.items() if v is not None])
|
||||||
|
|
||||||
@ -70,7 +72,7 @@ def run_postprocessing(extras_mode, image, image_folder, input_dir, output_dir,
|
|||||||
pp.image.info["postprocessing"] = infotext
|
pp.image.info["postprocessing"] = infotext
|
||||||
|
|
||||||
if save_output:
|
if save_output:
|
||||||
images.save_image(pp.image, path=outpath, basename=basename, seed=None, prompt=None, extension=opts.samples_format, info=infotext, short_filename=True, no_prompt=True, grid=False, pnginfo_section_name="extras", existing_info=existing_pnginfo, forced_filename=None)
|
images.save_image(pp.image, path=outpath, basename=basename, extension=opts.samples_format, info=infotext, short_filename=True, no_prompt=True, grid=False, pnginfo_section_name="extras", existing_info=existing_pnginfo, forced_filename=forced_filename)
|
||||||
|
|
||||||
if extras_mode != 2 or show_extras_results:
|
if extras_mode != 2 or show_extras_results:
|
||||||
outputs.append(pp.image)
|
outputs.append(pp.image)
|
||||||
|
@ -57,6 +57,9 @@ class Upscaler:
|
|||||||
dest_h = int((img.height * scale) // 8 * 8)
|
dest_h = int((img.height * scale) // 8 * 8)
|
||||||
|
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
|
if img.width >= dest_w and img.height >= dest_h:
|
||||||
|
break
|
||||||
|
|
||||||
shape = (img.width, img.height)
|
shape = (img.width, img.height)
|
||||||
|
|
||||||
img = self.do_upscale(img, selected_model)
|
img = self.do_upscale(img, selected_model)
|
||||||
@ -64,9 +67,6 @@ class Upscaler:
|
|||||||
if shape == (img.width, img.height):
|
if shape == (img.width, img.height):
|
||||||
break
|
break
|
||||||
|
|
||||||
if img.width >= dest_w and img.height >= dest_h:
|
|
||||||
break
|
|
||||||
|
|
||||||
if img.width != dest_w or img.height != dest_h:
|
if img.width != dest_w or img.height != dest_h:
|
||||||
img = img.resize((int(dest_w), int(dest_h)), resample=LANCZOS)
|
img = img.resize((int(dest_w), int(dest_h)), resample=LANCZOS)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user