Nodes/DazzleNodes Collection/Preview Bridge Extended (DazzleNodes)
ComfyUI Node

Preview Bridge Extended (DazzleNodes)

Preview, Paint the Mask, and Gate the Run in One Node

By DazzleNodes·Created 10 months ago·Updated 5 months ago· 4
Preview Bridge Extended (DazzleNodes)
  • images
  • mask_opt
  • dazzle_signal
  • image
  • mask
  • info
image
mask_outputcombined
editor_targetcombined
restore_masknever
blocknever

A plain Preview Bridge does one job: show you an image mid-workflow so you can see what a node produced before it keeps flowing. Preview Bridge Extended (PBE) is that, plus a mask editor that lets you draw on the image in place and pipe a clean mask downstream - then, if you want, refuse to run until you actually have. For anyone doing inpainting in ComfyUI, it collapses three or four nodes (preview, mask editor, mask combine, gate) into one box.

The workflow looks like: image comes in, you paint over the thing you want regenerated, the node emits image and mask, and you feed the mask to SetLatentNoiseMask or an inpainting sampler. Where it gets genuinely smart is that it's a three-layer mask system, not one flat layer.

The layers and the widgets that control them

It tracks three things: the input mask you wired into mask_opt from upstream (shown red), your editor drawings (shown orange), and the parts you erase (subtractions). Two widgets decide how they interact, and the author's tooltips are worth reading because they're the whole mental model:

  • mask_output - what the output mask slot carries. combined ORs input mask + editor drawings (default), mask_editor gives you only what you drew, input_mask gives you only the upstream mask.
  • editor_target - what the editor is allowed to touch. combined edits both layers, mask_editor locks the red input layer, input_mask locks your drawings.

So you can route an auto-generated mask (SAM, a detector, whatever) in, refine it by hand, and either export the combined result or just your own corrections. The preview updates immediately when you switch modes - WYSIWYG, no re-run needed.

Blocking: the underrated superpower

The block widget is where PBE earns its keep. Set it to if_empty_mask and the node halts the pipeline when the output mask is empty; if_empty_editor halts when you haven't drawn anything; always is a debugging backstop. This is the fix for the classic wasted-run problem - the KSampler burns a generation with an empty or accidental mask and you only notice at the end. PBE stops the train before the expensive part.

restore_mask (never / always / if_same_size) keeps your mask across image changes, which matters in iterative workflows where the canvas regenerates but you want your region to survive. It's also cache-friendly: it writes deterministic preview filenames so ComfyUI's cache doesn't invalidate downstream nodes just because a preview changed.

There's an optional dazzle_signal input that ties into Dazzle Command - the play/pause orchestration node in the same pack. Wire them together and the pause state makes PBE block automatically. Nice to have; completely ignorable if you're not running the whole suite.

Install and the one trap

Search DazzleNodes in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone --recursive https://github.com/DazzleNodes/DazzleNodes.git

Restart, find it under DazzleNodes → Preview Bridge Extended. No models, no extra pip deps.

The trap is the same empty-mask shape bug that bites all preview-bridge-style nodes: an empty mask can come out as [H, W] instead of [B, H, W], and downstream inpainting-crop nodes read that as a batch of single-pixel masks and spit out dozens of images. If that happens to you, it's not this node being broken - it's downstream assuming a shape you don't have. Hook the mask into a FitMaskToImage (same pack) before the crop, or set block to if_empty_mask so the case can't silently reach downstream at all.

CategoryDazzleNodes

Inputs (8)

NameTypeDefaultDescription
imagesIMAGE
imageSTRING
mask_optoptMASK
mask_outputoptCOMBOcombinedControls what goes to the OUTPUT mask slot. combined: OR combine input_mask + mask_editor drawings mask_editor: Only output the editor mask layer input_mask: Only output the input mask layer Preview displays the selected output mode (WYSIWYG).
editor_targetoptCOMBOcombinedControls WHAT is editable in MaskEditor. Display always shows: red=input mask, orange=editor mask. combined: Edit both input + editor masks together (default) mask_editor: Only edit editor mask (input mask shown as red, locked) input_mask: Only edit input mask (editor mask shown as orange, locked)
restore_maskoptCOMBOneverif_same_size: Restore cached mask if new image has same dimensions always: Always restore cached mask (resized if needed) never: Do not restore cached masks Note: restore_mask has higher priority than block
blockoptCOMBOnevernever: Never block execution if_empty_mask: Block if the OUTPUT mask is empty if_empty_editor: Block if user hasn't drawn in MaskEditor always: Always block execution (debugging backstop)
dazzle_signaloptDAZZLE_SIGNALOrchestration signal from Dazzle Command node. Controls block behavior based on workflow state (playing/paused). Optional -- no effect without connection.

Outputs (3)

NameTypeDescription
imageIMAGE
maskMASK
infoSTRING