Nodes/Comfyui_LG_Tools/🎈LG_PreviewBridge_V2
ComfyUI Node

🎈LG_PreviewBridge_V2

Save an image and paint its mask, in one node

By LAOGOU-666·Created 2 years ago·Updated 7 months ago· 369
🎈LG_PreviewBridge_V2
  • images
  • 处理后图像
  • 遮罩
file_info
skipfalse

BridgePreviewNode (🎈LG_PreviewBridge_V2) is the V2 of the pack's preview bridge, and it bundles two things you'd otherwise wire separately: it saves your image to the ComfyUI output folder and lets you paint a mask on it before the graph continues. The node description in the schema is understated - "saves the input images to your ComfyUI output directory" - but the actual point is the mask editing. You get the saved image, the mask you painted, and both come out as outputs.

Why does that matter? Mask-based inpainting is still the one thing edit models can't replace - the KB's inpainting doc makes the case cleanly: masked inpainting gives you bit-identical unmasked pixels and full-resolution detail on the masked region, which no instruction-editing model offers. The awkward part has always been the loop: save image, open it in an editor, paint a mask, import the mask back. BridgePreviewNode collapses that into "queue, paint on the node, done."

How it works

It's a subclass of ComfyUI's built-in PreviewImage, which is what gives it the save-to-output behavior and the mask painting UI. When it runs, it saves the image as an RGBA PNG (alpha = your mask) with the workflow's prompt metadata embedded, then blocks while you paint on the node's preview. The painted mask comes out alongside the image. The skip input is the automation escape hatch: flip it true and it skips the dialog, returning the original image plus an all-white mask - or a cached result if the input hasn't changed.

The inputs that matter

  • images (IMAGE) - what you're previewing and masking.
  • file_info (STRING, readonly) - informational; it carries file/path info from the loader for the bridge, and you don't set it by hand.
  • skip (BOOLEAN, default false) - false opens the mask-editing dialog; true skips it and passes through (returns original image + all-white mask when there's no valid cache).

Outputs: 处理后图像 (the processed IMAGE) and 遮罩 (the MASK you painted), which feed straight into a Set Mask / inpaint region step.

The V2 vs. the V1

The older CachePreviewBridge in this pack works from a file path and needs an explicit "Cache" click to freeze the image before you edit its mask. V2 takes an image tensor directly and - key improvement - respects skip, so you can automate around it. If you're wiring this into an interactive inpainting loop, V2 is the one; V1 is for the older path-based cache workflow.

Installing it

Part of Comfyui_LG_Tools:

cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/Comfyui_LG_Tools.git
pip install -r requirements.txt

Or via ComfyUI Manager → "Comfyui_LG_Tools" → restart. It's under Add Node → 🎈LAOGOU → Image.

Common issues

  • "It never waits for me to paint." If skip is on, it won't. Turn it off. Headless/API runs also can't show the dialog, so it'll fall back to skip-style behavior.
  • "My mask came out all white." That's the default when nothing was painted or skip is active - a white mask means "mask everything," so double-check you actually painted on the node.
  • Output masks vs. inpainting masks. The mask output is the alpha you painted. Depending on your inpainting node's convention you may need to invert it before it means "inpaint here."

For interactive inpainting it's a genuinely nice piece of the pack - save, mask, and continue without ever leaving the graph. Just remember it's an interactive node; automation is via skip, not by hoping the dialog times out gracefully.

Category🎈LAOGOU/Image

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
file_infoSTRING
skipBOOLEANfalse

Outputs (2)

NameTypeDescription
处理后图像IMAGE
遮罩MASK