aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-01-04 18:20:38 +0300
committerAUTOMATIC <16777216c@gmail.com>2023-01-04 18:20:38 +0300
commita8eb9e3bf814f72293e474c11e9ff0098859a942 (patch)
tree55d652b5b69a26b1fb59bdf27349acff7c08d707 /modules
parenteed58279e7cb0e873ebd88a29609f9bab0f1f3af (diff)
Revert "Merge pull request #3791 from shirayu/fix/filename"
This reverts commit eed58279e7cb0e873ebd88a29609f9bab0f1f3af, reversing changes made to 4ae960b01c6711c66985479f14809dc7fa549fc2.
Diffstat (limited to 'modules')
-rw-r--r--modules/images.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/modules/images.py b/modules/images.py
index 2967fa9a..c3a5fc8b 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -447,14 +447,6 @@ def get_next_sequence_number(path, basename):
return result + 1
-def truncate_fullpath(full_path, encoding='utf-8'):
- dir_name, full_name = os.path.split(full_path)
- file_name, file_ext = os.path.splitext(full_name)
- max_length = os.statvfs(dir_name).f_namemax
- file_name_truncated = file_name.encode(encoding)[:max_length - len(file_ext)].decode(encoding, 'ignore')
- return os.path.join(dir_name , file_name_truncated + file_ext)
-
-
def save_image(image, path, basename, seed=None, prompt=None, extension='png', info=None, short_filename=False, no_prompt=False, grid=False, pnginfo_section_name='parameters', p=None, existing_info=None, forced_filename=None, suffix="", save_to_dirs=None):
"""Save an image.
@@ -495,7 +487,7 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
if save_to_dirs:
dirname = namegen.apply(opts.directories_filename_pattern or "[prompt_words]").lstrip(' ').rstrip('\\ /')
- path = truncate_fullpath(os.path.join(path, dirname))
+ path = os.path.join(path, dirname)
os.makedirs(path, exist_ok=True)
@@ -519,13 +511,13 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
fullfn = None
for i in range(500):
fn = f"{basecount + i:05}" if basename == '' else f"{basename}-{basecount + i:04}"
- fullfn = truncate_fullpath(os.path.join(path, f"{fn}{file_decoration}.{extension}"))
+ fullfn = os.path.join(path, f"{fn}{file_decoration}.{extension}")
if not os.path.exists(fullfn):
break
else:
- fullfn = truncate_fullpath(os.path.join(path, f"{file_decoration}.{extension}"))
+ fullfn = os.path.join(path, f"{file_decoration}.{extension}")
else:
- fullfn = truncate_fullpath(os.path.join(path, f"{forced_filename}.{extension}"))
+ fullfn = os.path.join(path, f"{forced_filename}.{extension}")
pnginfo = existing_info or {}
if info is not None: