diff --git a/modules/images.py b/modules/images.py index 2ce5c67c1..18d1de2fc 100644 --- a/modules/images.py +++ b/modules/images.py @@ -575,7 +575,7 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i fullfn_without_extension, extension = os.path.splitext(params.filename) if hasattr(os, 'statvfs'): max_name_len = os.statvfs(path).f_namemax - fullfn_without_extension = fullfn_without_extension[:max_name_len - len(extension)] + fullfn_without_extension = fullfn_without_extension[:max_name_len - max(4, len(extension))] params.filename = fullfn_without_extension + extension _atomically_save_image(image, fullfn_without_extension, extension)