aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorw-e-w <40751091+w-e-w@users.noreply.github.com>2022-10-22 17:16:55 +0900
committerAUTOMATIC1111 <16777216c@gmail.com>2022-10-24 10:28:42 +0300
commitc5d90628a4058bf49c2fdabf620a24db73407f31 (patch)
tree0a06ad3c28c660d2ec851c5ec3c51a695a8df0ba /modules
parent3be6b29d81408d2adb741bff5b11c80214aa621e (diff)
move "file_decoration" initialize section
into "if forced_filename is None:" no need to initialize it if it's not going to be used
Diffstat (limited to 'modules')
-rw-r--r--modules/images.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/images.py b/modules/images.py
index b9589563..50a59cff 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -386,18 +386,6 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
txt_fullfn (`str` or None):
If a text file is saved for this image, this will be its full path. Otherwise None.
'''
- if short_filename or prompt is None or seed is None:
- file_decoration = ""
- elif opts.save_to_dirs:
- file_decoration = opts.samples_filename_pattern or "[seed]"
- else:
- file_decoration = opts.samples_filename_pattern or "[seed]-[prompt_spaces]"
-
- if file_decoration != "":
- file_decoration = "-" + file_decoration.lower()
-
- file_decoration = apply_filename_pattern(file_decoration, p, seed, prompt) + suffix
-
if extension == 'png' and opts.enable_pnginfo and info is not None:
pnginfo = PngImagePlugin.PngInfo()
@@ -419,6 +407,18 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
os.makedirs(path, exist_ok=True)
if forced_filename is None:
+ if short_filename or prompt is None or seed is None:
+ file_decoration = ""
+ elif opts.save_to_dirs:
+ file_decoration = opts.samples_filename_pattern or "[seed]"
+ else:
+ file_decoration = opts.samples_filename_pattern or "[seed]-[prompt_spaces]"
+
+ if file_decoration != "":
+ file_decoration = "-" + file_decoration.lower()
+
+ file_decoration = apply_filename_pattern(file_decoration, p, seed, prompt) + suffix
+
basecount = get_next_sequence_number(path, basename)
fullfn = "a.png"
fullfn_without_extension = "a"