create output dir if none is present

This commit is contained in:
BazettFraga 2023-02-09 18:32:23 +01:00 committed by comfyanonymous
parent 773cdabfce
commit 642516a3a6
1 changed files with 3 additions and 0 deletions

View File

@ -493,6 +493,9 @@ class SaveImage:
counter = max(filter(lambda a: a[1][:-1] == filename_prefix and a[1][-1] == "_", map(map_filename, os.listdir(self.output_dir))))[0] + 1
except ValueError:
counter = 1
except FileNotFoundError:
os.mkdir(self.output_dir)
counter = 1
for image in images:
i = 255. * image.cpu().numpy()
img = Image.fromarray(i.astype(np.uint8))