Nodes/NKD Preview Tools/😺NKD Reference
ComfyUI Node

😺NKD Reference

NKD Reference gives the popup a second image

By Nekodificador·Created 5 months ago·Updated 11 days ago· 38
😺NKD Reference
  • image

    Say you're doing img2img from a photo, or inpainting a specific region, or matching a reference pose. Every queue, you're comparing the new output against the source - which in vanilla ComfyUI means an extra image viewer, alt-tabbing, or a second browser tab. NKD Reference exists to end that: you drop it in the graph, feed it the image you care about, and then your NKD Popup Preview can flash it over the live output the instant you release a key.

    The idea is elegant and small. The node captures whatever IMAGE (or MASK) is connected as the workflow's active reference, and any NKD Popup Preview in the same session can then:

    • press-and-hold Space (or the Hold for Ref button) to swap the current output for the reference - release, and you're back to the live render;
    • toggle the mask overlay, which tints your reference mask over the preview so you can check whether a region aligns with what the model painted.

    The mechanism is worth knowing because it explains the two things beginners get wrong. When the node executes, it saves the first frame of your tensor to ComfyUI's temp folder - the image as a normal PNG, the mask as grayscale that gets tinted on the client side. That's it: there's no live pipe, just a saved snapshot that the popup pulls in. Two consequences follow. First, image and mask are separate slots - wire two Reference nodes if you want both, one for each type. Second, within a slot, the last-executed node wins, so if you have two Reference nodes feeding images into the same slot, whichever ran most recently is what you'll see. The tooltips and the node's own docs are explicit about this, and it's the whole personality of the node.

    The node itself has a single input that accepts either an IMAGE or a MASK - the pack disambiguates the type at runtime - and no outputs. It's an output/utility node: you don't wire anything out of it, you just let it sit in the graph and execute. Current versions of the code also snap up VIDEO inputs into a third slot, though the documented, stable use is images and masks.

    Install

    Same as the rest of the pack, which means pleasantly boring: no Python dependencies, no model downloads.

    cd ComfyUI/custom_nodes
    git clone https://github.com/Nekodificador/ComfyUI-NKD-Preview-Tools.git
    # restart ComfyUI
    

    Or search "NKD Preview Tools" in ComfyUI Manager. The repo's old name - ComfyUI-NKD-Popup-Preview, which this page is filed under - still redirects, so either works.

    Where people get burned

    Order matters. The reference is captured when its node runs, so it needs to execute before you use it - if you queue the popup in isolation and the reference node didn't run, there's nothing to flash. That's also exactly why the "primary popup + queue only that" trick from the preview node's page pairs so well: keep the reference node in the executed path and you always have a compare available. And remember the last-executed-wins rule: if you wire a second Reference into the same slot, you're not merging, you're replacing. Wire two nodes for image and mask, and let that be the whole workflow - it's a small utility, but it's the difference between "iterate" and "iterate and keep alt-tabbing to see what I started from."

    Category😺NKD Nodes/Preview

    Inputs (1)

    NameTypeDefaultDescription
    imageIMAGE,MASK,VIDEO

    Outputs (0)

    No outputs