Skip to content

Commit

Permalink
Add a random string to the temp prefix for PreviewImage.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jul 11, 2023
1 parent 2b2a147 commit f4b9390
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import traceback
import math
import time
import random

from PIL import Image, ImageOps
from PIL.PngImagePlugin import PngInfo
Expand Down Expand Up @@ -1116,6 +1117,7 @@ class SaveImage:
def __init__(self):
self.output_dir = folder_paths.get_output_directory()
self.type = "output"
self.prefix_append = ""

@classmethod
def INPUT_TYPES(s):
Expand All @@ -1133,6 +1135,7 @@ def INPUT_TYPES(s):
CATEGORY = "image"

def save_images(self, images, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None):
filename_prefix += self.prefix_append
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0])
results = list()
for image in images:
Expand Down Expand Up @@ -1160,6 +1163,7 @@ class PreviewImage(SaveImage):
def __init__(self):
self.output_dir = folder_paths.get_temp_directory()
self.type = "temp"
self.prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5))

@classmethod
def INPUT_TYPES(s):
Expand Down

0 comments on commit f4b9390

Please sign in to comment.