docs: add prefix rules as class docstring and UI tooltip

This commit is contained in:
1lch2
2026-05-25 18:42:31 +08:00
parent 43ca4dbacf
commit 40242aae94
+27 -1
View File
@@ -24,6 +24,22 @@ def _create_webp_metadata(img, prompt, extra_pnginfo):
class SaveImageAsSDWebUI:
"""Save images in SD WebUI style with date-based subfolders and workflow metadata.
Prefix rules (output_dir = ComfyUI/output):
"txt2img/" -> output/txt2img/{date}/00001-seed.ext
"abc" -> output/{date}/abc00001-seed.ext
"imgEdit/qwen" -> output/imgEdit/{date}/qwen00001-seed.ext
"" -> output/{date}/00001-seed.ext
"abc/def/" -> output/abc/def/{date}/00001-seed.ext
"abc/def/114514" -> output/abc/def/{date}/11451400001-seed.ext
{date} = yyyy-mm-dd, always the direct parent folder of the file.
Slash at end = directory only, no filename prefix.
No slash = filename prefix only, no subdirectory.
Middle slash(s) = nested directories above date folder.
"""
def __init__(self):
self.output_dir = folder_paths.get_output_directory()
self.type = "output"
@@ -35,7 +51,17 @@ class SaveImageAsSDWebUI:
"required": {
"images": ("IMAGE", {"tooltip": "The images to save."}),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "tooltip": "Seed value used in the filename."}),
"filename_prefix": ("STRING", {"default": "ComfyUI", "tooltip": "Prefix for the filename. Can include path separators (e.g. 'comfy-txt2img/') for subdirectory classification."}),
"filename_prefix": ("STRING", {"default": "ComfyUI", "tooltip": (
"Filename prefix and/or output subdirectory.\n"
"A date folder (yyyy-mm-dd) is always created as the direct parent.\n\n"
"Examples (output dir = ComfyUI/output):\n"
" 'txt2img/' -> output/txt2img/{date}/00001-seed.ext\n"
" 'abc' -> output/{date}/abc00001-seed.ext\n"
" 'imgEdit/qwen' -> output/imgEdit/{date}/qwen00001-seed.ext\n"
" '' -> output/{date}/00001-seed.ext\n"
" 'abc/def/' -> output/abc/def/{date}/00001-seed.ext\n"
" 'abc/def/114514' -> output/abc/def/{date}/11451400001-seed.ext"
)}),
"image_format": (["png", "jpg", "webp"], {"default": "png", "tooltip": "Image save format."}),
"quality": ("INT", {"default": 100, "min": 0, "max": 100, "tooltip": "Save quality for JPG/WebP formats (0-100). Ignored for PNG."}),
},