Nodes/Smart Save Image/Smart Save Image
ComfyUI Node

Smart Save Image

Stop guessing where your images land — Smart Save Image shows you before you queue

By yurishk·Created about a month ago·Updated about a month ago· 2
Smart Save Image
  • images
  • model_input
    root_modeoutput
    custom_root
    folder_template%date:yyyy-MM-dd%/%model%
    filename_template%model%_%seed%
    file_formatpng
    quality95
    collision_modeincrement
    save_modesave_and_preview
    manual_modelauto
    embed_workflowtrue
    counter_digits3
    png_compression4
    variable_overrides{"version":1,"items":[]}

    Every ComfyUI save node has the same flaw: you type a filename rule, queue the run, and then go spelunking through output/ to find out where the thing actually went. Smart Save Image (class SmartSaveImage, from the yurishk/ComfyUl-SaveImage pack) is the one that fixes that - it previews the real destination folder and an example filename before you queue, right on the node.

    That preview is the whole pitch, and it's not a gimmick. The node ships a small backend endpoint (/smartsave/preview) plus custom frontend that run the exact same template logic used at save time. As you type in the folder or filename rule, it sends your current workflow graph to that endpoint and gets back the resolved path, whether the folder already exists, how many images are in it, and what the next files would actually be called. You see output/krea/sdxl_base_1.0/image_00042.png with a "directory does not exist yet" note before you've burned a single GPU second.

    What makes it work is the model-reading. Rather than assuming your loader's input is named ckpt_name (a lot of save nodes hardcode that and silently break on third-party loaders), it scans the whole prompt graph for checkpoint, UNet, LoRA, VAE, seed, steps, CFG, sampler, and prompt values with a pile of fallback keys and a class-name check (CheckpointLoader-ish nodes get a second pass). It even falls back to EmptyLatentImage dimensions when there's no real image to measure. Everything gets sanitized - invalid filename characters become _, Windows reserved names like CON get an underscore, and only literal slashes you type create subfolders, so a model name containing / can't explode your directory tree.

    The inputs that actually matter

    • images - the batch to save. This is your only required wire.
    • folder_template / filename_template - the rules. Defaults are %date:yyyy-MM-dd%/%model% and %model%_%seed%. Tokens cover date/time, %model%, %model_full%, %unet%, %lora%/%loras%, %vae%, %seed%, %steps%, %cfg%, %sampler%, %scheduler%, %width%, %height%, %prompt%, %negative%, %batch%, plus custom ones you define.
    • root_mode + custom_root - output (default), input, temp, or custom for an absolute/relative path. Leave custom_root blank and it falls back to output.
    • collision_mode - increment auto-numbers to avoid overwriting; overwrite clobbers same-named files.
    • save_mode - save_and_preview (default), save_only, or preview_only (delegates to the core Preview Image node for throwaway runs).

    Worth knowing: quality exists in the schema but is a legacy field - it's hidden in the new UI. The ones you actually tweak are png_compression (0–9, default 4 to match ComfyUI's built-in save) and counter_digits (how many digits the batch suffix uses). embed_workflow toggles metadata, and manual_model or a wired model_input overrides the auto-detected model name.

    One real take

    Smart Save writes a ComfyUI-native prompt/workflow chunk into PNGs and an A1111-style parameters text block. That's the flat string CivitAI's uploader keys on for auto-linking your model and LoRAs - the exact reason the KB essay "Stop using ComfyUI's default Save Image node (if you post to Civitai)" exists. JPEG/WebP can't hold the node graph; those get the parameters in EXIF instead, which is the best you can do outside PNG.

    Install and gotchas

    No models, no heavy deps - requirements are just Pillow and NumPy, both already in ComfyUI. Install "smart-save-image" from ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yurishk/ComfyUl-SaveImage
    

    then restart ComfyUI. Where people get burned: the target folder isn't created until the first save, so "does not exist yet" in the preview is normal. If you save to an absolute path outside output/input/temp, ComfyUI can't serve a direct preview and the node falls back to a temp preview - the file is still where you told it to be. And if you run with --disable-metadata, the embedding is silently skipped, because the node respects that global flag. One more: the pack's UI is bilingual (English/Simplified Chinese), the author is a solo dev, and this is genuinely a niche utility - but for organized output it's the nicest version of this problem I've found.

    Categoryimage/save

    Inputs (15)

    NameTypeDefaultDescription
    imagesIMAGE需要保存的图片或图片批次。
    root_modeCOMBOoutput根目录:output=ComfyUI 输出目录;custom=自定义绝对/相对路径;input/temp 为内置目录。
    custom_rootSTRING仅当 root_mode=custom 生效;可用绝对路径,留空回退到 output。
    folder_templateSTRING%date:yyyy-MM-dd%/%model%子目录模板,支持多级与占位符,如 %date%/%model%/%sampler%。
    filename_templateSTRING%model%_%seed%文件名模板(不含扩展名)。批量时自动追加序号,或用 %batch% 自定义位置。
    file_formatCOMBOpng3 options: png, jpeg, webp
    qualityINT951–100旧工作流兼容字段,不在新版界面中显示。
    collision_modeCOMBOincrementincrement=自动编号避免覆盖;overwrite=覆盖同名文件。
    save_modeCOMBOsave_and_preview3 options: save_and_preview, save_only, preview_only
    manual_modeloptCOMBOauto手动指定模型名以覆盖自动读取(auto=自动从工作流读取)。
    embed_workflowoptBOOLEANtruePNG 写入 ComfyUI 工作流元数据;JPEG/WebP 写入 EXIF。
    counter_digitsoptINT30–8批量/防冲突序号位数,0 表示尽量不加序号。
    png_compressionoptINT40–9PNG 无损压缩等级;4 与 ComfyUI 自带保存节点一致。
    variable_overridesoptSTRING{"version":1,"items":[]}当前保存节点独立使用的模板变量覆盖与自定义变量。
    model_inputopt*可连接模型对象或模型名称;连接后优先于手动模型来源。

    Outputs (0)

    No outputs