ComfyUI Node

萌宝AI·预览图片

Preview like the stock node, but keep the good one

By Corkery520·Created 3 days ago·Updated 3 days ago· 0
萌宝AI·预览图片
  • images
    generation_prompt

    Preview Image is the node you leave on the end of a graph while iterating, precisely because it writes to temp/ instead of output/ and doesn't leave 300 throwaway PNGs behind. That's also its flaw: when one of the previews is good, you either re-run with a save node or go hunting in a scratch directory that ComfyUI clears.

    MengBaoPreviewImage (萌宝AI·预览图片) keeps the cheap behaviour - it wraps ComfyUI's native PreviewImage exactly the way its sibling MengBaoSaveImage wraps SaveImage, schema and all, writing to temp/ with no changes to native preview semantics - and adds the rescue hatch. Two buttons under the display: Add to material library and Add to prompt library. Spot a keeper and it's filed permanently, no re-run.

    What those buttons really do

    "Add to material library" writes the currently displayed image into the pack's material store via the same API MengBaoMaterialLibrary uses: full original resolution, alpha preserved, size-validated, and explicitly not a thumbnail substitute. That's the difference between a draft and an asset, and it's why this node pairs so well with the replication chain - a generated product shot can go straight back into reverse/settings as a reference.

    "Add to prompt library" opens the pack's prompt form pre-filled with the prompt behind the image and a thumbnail (longest edge 512px, pixels only - the original's embedded workflow metadata is deliberately not copied into the library record). Edit the title, group and tags, save, and the prompt is searchable forever. The thumbnail survives even after the temp preview is wiped, which is the whole point.

    For batches, the panel lets you switch between frames and files the one you're looking at. When the prompt can't be attributed to a single source - several upstream candidates, or a prompt built by a node the detector doesn't know - you get a picker first, and an empty draft if it can't identify anything at all. It would rather ask than invent a prompt and file it under the wrong picture. To short-circuit that, wire the optional generation_prompt input: an explicit connection beats every guess the graph-walking makes.

    Inputs and outputs

    images (IMAGE) is the only required input. generation_prompt is optional and, importantly, a forced input - you can only drive it from a wire, not type into it, which is the author nudging you to use it deliberately. No outputs: this is a terminal output node.

    That's the notable asymmetry with MengBaoSaveImage, which takes filename_prefix because the native node does. Preview has no filename to set, since the file is disposable.

    Installing it

    Part of ComfyUI-MengBaoAI (Corkery520, 17 nodes, MIT, Registry id mengbaoai). Manager: search MengBaoAI / mengbaoai / 萌宝AI. CLI: comfy node install mengbaoai. Git, while the Registry release is still clearing platform scanning:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Corkery520/ComfyUI-MengBaoAI.git
    cd ComfyUI-MengBaoAI
    python -m pip install -r requirements.txt
    

    numpy, Pillow, requests. This node needs ComfyUI's native PreviewImage importable, and the pack's panel needs its local HTTP routes up, so restart after installing and Ctrl+F5 after updating - the docs flag stale front-end scripts as the usual cause of dead buttons. Search 预览图片, Preview Image, or MengBaoPreviewImage on the canvas.

    If you're migrating from the old standalone plugins, disable them first; duplicate routes are the documented consequence of both being active.

    Things that bite

    • temp is temp. If you preview, close ComfyUI, and never pressed a button, the image may be gone - that's the native behaviour you opted into by using a preview node.
    • The buttons are disabled while empty, and while a save is in flight. That's intentional anti-double-submit behaviour; status text tells you what happened.
    • Auto-detection only knows a few node types. It recognises the pack's generation node and the stock positive CLIPTextEncode behind a KSampler. Custom text nodes, dynamic prompts and the pack's own prompt reader need generation_prompt wired in.
    • Filing a prompt isn't filing the image. The library gets a thumbnail and text; the full-resolution image only lands in the material library if you press that other button.
    Category萌宝AI/图像处理

    Inputs (2)

    NameTypeDefaultDescription
    imagesIMAGE
    generation_promptoptSTRING

    Outputs (0)

    No outputs