mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 11:12:35 +00:00
save_images_add_number_suffix
This commit is contained in:
@@ -661,7 +661,15 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
|
||||
|
||||
save_image_with_geninfo(image_to_save, info, temp_file_path, extension, existing_pnginfo=params.pnginfo, pnginfo_section_name=pnginfo_section_name)
|
||||
|
||||
os.replace(temp_file_path, filename_without_extension + extension)
|
||||
full_file_name = filename_without_extension + extension
|
||||
if shared.opts.save_images_add_number_suffix and os.path.exists(full_file_name):
|
||||
count = 1
|
||||
while True:
|
||||
full_file_name = f"{filename_without_extension}_{count}{extension}"
|
||||
if not os.path.exists(full_file_name):
|
||||
break
|
||||
count += 1
|
||||
os.replace(temp_file_path, full_file_name)
|
||||
|
||||
fullfn_without_extension, extension = os.path.splitext(params.filename)
|
||||
if hasattr(os, 'statvfs'):
|
||||
|
Reference in New Issue
Block a user