diff --git a/modules/images.py b/modules/images.py index 8c06ff2403780d8daa21f0c9e8e381610cd9df83..1c01d6d89c24b7165e1220b19155c82b5c765b00 100644 --- a/modules/images.py +++ b/modules/images.py @@ -13,7 +13,7 @@ import string import modules.shared from modules import sd_samplers, shared -from modules.shared import opts +from modules.shared import opts, cmd_opts LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS) @@ -277,6 +277,9 @@ def apply_filename_pattern(x, p, seed, prompt): x = x.replace("[model_hash]", shared.sd_model_hash) x = x.replace("[date]", datetime.date.today().isoformat()) + if cmd_opts.hide_ui_dir_config: + x = re.sub(r'^[\\/]+|\.{2,}[\\/]+|[\\/]+\.{2,}', '', x) + return x def get_next_sequence_number(path, basename):