Nodes/MKRShift_Nodes/Presave Image
ComfyUI Node

Presave Image

The preview/save hybrid that keeps your output folder honest

By criskb·Created 7 months ago·Updated 5 months ago· 0
Presave Image
  • image
  • mask
    preview_onlytrue
    output_formatpng
    animation_modeauto
    filename_prefixMKR
    subfolder
    overwritefalse
    save_maskfalse
    orientationhorizontal
    split_percent0.500
    fit_modecontain
    png_compress_level4
    jpeg_quality92
    webp_quality90
    animation_fps12
    animation_loop0
    filename_labels

    Every ComfyUI user hits the SaveImage-versus-PreviewImage fork in the road eventually. SaveImage commits a permanent PNG to output/; PreviewImage writes a throwaway to temp/ so you can iterate without burying your output folder in rejects. MKRPreSave is the pack's answer to that false choice: it's one node that starts life as a preview and flips into a real save when you're ready. Hence the name - it's a pre-save.

    What it's for

    You reach for it at the end of a chain when you're generating batches and want to (a) see what you made without polluting output/, and (b) still have a one-click path to real files with the quality settings you care about. The preview_only boolean defaults to true, which means out of the box it behaves like a PreviewImage. Uncheck it and it writes PNG/JPEG/WebP/GIF to output/<subfolder> instead. Same node, two lives.

    It's also an output node that always runs - the source returns float("nan") from IS_CHANGED, which in ComfyUI terms means "rerun me every queue event, don't cache me away" (see the node-plumbing docs for why that trick works). And it ships a custom frontend via the pack's WEB_DIRECTORY, so the widgets you see are the author's own.

    Inputs that matter

    • preview_only - the whole gimmick. True = preview in temp, False = commit to disk.
    • output_format - png, jpeg, webp, or gif. PNG is default, and the only one that embeds the workflow metadata (the "drag it back in and rebuild the graph" trick lives in the PNG text chunks).
    • animation_mode - auto (decides from frame count and format), single_animation (one animated gif/webp from the batch), or per_frame (one file per frame).
    • orientation + split_percent + fit_mode - this is the custom frontend's showpiece: a side-by-side split preview (horizontal or vertical, split at split_percent, contain/cover/stretch for fit). Great for before/after compares.
    • save_mask - if you also feed the optional mask input, it can write the mask out too.
    • filename_prefix, subfolder, overwrite - standard output plumbing. filename_labels (optional) lets you give frames their own names.

    Compression/quality knobs: png_compress_level, jpeg_quality, webp_quality, and animation_fps + animation_loop for animated output.

    Installing it

    Pack-level install, unchanged:

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    then restart ComfyUI (or search MKRShift_Nodes in ComfyUI Manager). This node is pure PIL + torch - no ffmpeg needed, no extra requirements.

    Common issues

    The classic self-inflicted wound: you leave preview_only checked for a week, generate a whole batch, and nothing ever lands in output/. That's not a bug - flip the toggle. The reverse is also worth knowing: PNG embeds the workflow, but JPEG/WebP/GIF don't carry the graph, so if you care about "workflow included," keep your final deliverable PNG. And if you're animating, remember single_animation only produces an animated file for gif/webp - asking it for a single-animation PNG just gets you one still.

    CategoryMKRShift Nodes/Inspect/Preview

    Inputs (18)

    NameTypeDefaultDescription
    imageIMAGE
    preview_onlyBOOLEANtrue
    output_formatCOMBOpng4 options: png, jpeg, webp, gif
    animation_modeCOMBOauto3 options: auto, single_animation, per_frame
    filename_prefixSTRINGMKR
    subfolderSTRING
    overwriteBOOLEANfalse
    save_maskBOOLEANfalse
    orientationCOMBOhorizontal2 options: horizontal, vertical
    split_percentFLOAT0.5000–1
    fit_modeCOMBOcontain3 options: contain, cover, stretch
    png_compress_levelINT40–9
    jpeg_qualityINT921–100
    webp_qualityINT901–100
    animation_fpsINT121–60
    animation_loopINT00–1000
    maskoptMASK
    filename_labelsoptSTRING

    Outputs (0)

    No outputs