Nodes/ComfyUI_Lam/保存图像应用输出
ComfyUI Node

保存图像应用输出

The SaveImage that bakes your own metadata into the PNG

By yanlang0123·Created 2 years ago·Updated 11 days ago· 77
保存图像应用输出
  • images
  • custom_prompt
    filename_prefixComfyUI

    Core SaveImage is fine. It's been there forever, it never breaks, and it saves exactly where you expect. The one thing it can't do is carry extra metadata you care about into the file. That's the whole reason SaveImgOutputLam (display name 保存图像应用输出, "save image application output") exists - it's a subclass of ComfyUI's own SaveImage with one genuinely useful addition.

    What's different

    It saves to the same output directory, uses the same filename/counter logic, and handles image batches identically. The difference is an optional custom_prompt input of type DICT. Whatever key/value pairs you feed it get written straight into the PNG's metadata as text chunks. Strings go in verbatim; anything that isn't a string gets JSON-serialized so a number or a nested dict round-trips cleanly.

    The inputs that matter:

    • images - the IMAGE tensor(s). Batch handling is identical to core SaveImage: each frame in the batch gets its own file with a counter suffix.
    • filename_prefix - defaults to ComfyUI, so you get output/ComfyUI_00001_.png.
    • custom_prompt - optional DICT. The point of the node. Wire in a dict like {"model": "juggernaut-xl", "cfg": 7, "note": "approved by client"} and those keys land in the file's metadata, readable later by any PNG metadata viewer.

    If you don't pass custom_prompt, it degrades into a plain SaveImage - it writes the standard prompt and extra_pnginfo chunks exactly like core does. So you can drop it into any existing workflow as a straight replacement and lose nothing, which makes it an easy "why not" swap.

    Why you'd reach for it

    Two cases make this more than a curiosity. First, dataset or caption work: bake a tag or caption dict straight into the file so the text and the image physically can't be separated when you move batches around. Second, provenance: keep a human-readable note of which model, LoRA, and seed produced the image right next to the prompt chunk ComfyUI already writes - handy when you hand images to a colleague or a client and want them to survive a trip through chat apps.

    It has no outputs, because it's an output node - it's the end of a branch, not a pass-through. Put it where you'd put SaveImage and don't expect a wire coming out of it.

    Installing it

    This ships inside the ComfyUI_Lam pack (yanlang0123/ComfyUI_Lam), a big Chinese-language pack. Easiest route is ComfyUI Manager - search "ComfyUI_Lam" and install. Or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanlang0123/ComfyUI_Lam
    

    Then restart ComfyUI. The catch: the pack's requirements.txt is a wall of heavy ML dependencies (opencv, insightface, librosa, scikit-image, kornia, redis - even full tensorflow). The README targets the Windows portable build and tells you to run its install.bat (Linux: install.sh) to pip-install everything from an Aliyun mirror. On a plain Python install you may need to run that requirements list yourself. If you only want the save node, you still pull the whole pack - there's no per-node install.

    One known pack quirk worth knowing before you start: it can throw a popup that says 请先添加AppParams节点 ("please add the AppParams node first"), and it has a habit of lingering even after you delete the pack from custom_nodes, because the web-extension registration survives. A full restart and clearing Manager's cache usually quiets it. Cosmetic, but it confuses people on day one.

    Troubleshooting

    There's not much to break here, because it inherits almost everything from core SaveImage. If custom_prompt has non-string values, expect them JSON-dumped, not prettified. If the file doesn't appear where you expected, remember the prefix is relative to the output directory and the counter starts over per run. Mostly: if you've ever saved an image in ComfyUI, you already know how this node behaves - it's that, plus your metadata on the side.

    Categoryimage

    Inputs (3)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI
    custom_promptoptDICT

    Outputs (0)

    No outputs