ComfyUI Node

PreviewSubselection

See your area-conditioning boxes before you waste a generation

By underclockeddev·Created 3 years ago·Updated 6 months ago· 17
PreviewSubselection
    • IMAGE
    total_width512
    total_height512
    width
    height
    x
    y
    subselection_colorred
    background_color#444444
    label
    preview_method

    PreviewSubselection has a deeply forgettable name and a genuinely useful job. If you've ever built an area-conditioning workflow - the ComfyUI way of regional prompting, where you feed ConditioningSetArea an x, y, width, height and hope the region lands where you meant - you know the pain. Coordinates are abstract. You set a box at x=170, y=0, w=340, h=1024, run a full generation, and discover the "left character" region actually bleeds halfway across the canvas. This node takes those same six numbers and draws you the box before you sample. It won't fix your regional conditioning, but it stops you from guessing the geometry blind.

    It's a one-file utility from underclockeddev (u/DriveWorld on Reddit), released back in January 2024 with an honest question attached: "Would anyone use this?" The author's own summary is the best one: it gives you a visual of which zone is covered by which conditioning, and it's output-only - a preview, not a click-and-drag input node. That input node never materialized, and the project has sat dormant since. It's a tiny, transparent, zero-risk tool, not a growing ecosystem.

    How it works

    There's nothing magic under the hood. The node builds an RGBA canvas of total_width × total_height, fills it with background_color, draws the region rectangle at x, y with size width, height in subselection_color, stamps your label inside it in black, and returns the result as an IMAGE tensor. It uses plain PIL and torch - no model, no API, no weights to download.

    The one input that changes behavior is preview_method. Passthrough just hands you the IMAGE to do with as you please. Render Here also saves a temp PNG and shows it in the UI, which is what you want when the node is your graph's end point. It's marked as an output node, so it works like the built-in Preview Image: ComfyUI treats it as a terminal and shows its result as you tweak.

    The author's trick for multi-region workflows: run several PreviewSubselection nodes (one per region) and merge them through Combine Masks into a single overview image showing every zone at once. That's the way to sanity-check an entire regional layout in one glance.

    The inputs that matter

    • total_width / total_height - the canvas size. Set these to match your Empty Latent dimensions.
    • x, y, width, height - the region. These are wired-up INT inputs, not plain widgets, because the whole point is to feed them from the same integer nodes that feed ConditioningSetArea. The author's honest confession: pulling all those integer nodes out of the conditioning widgets is the fiddly part. It's worth it once, then it's a template.
    • subselection_color / background_color - cosmetic strings, "red" or "#444444" and the like. Use high-contrast colors so the box reads against the canvas.
    • label - short text drawn inside the region, auto-scaled to fit. Leave it empty if you don't need it.

    The single output is an IMAGE - note it's RGBA, so treat it as a preview object rather than something to feed a VAE decode or a 3-channel image pipeline.

    Installing it

    Nothing to download, no requirements beyond what ComfyUI already ships (PIL, numpy, torch). ComfyUI Manager should find it as ComfyUI-PreviewSubselection-Node, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/underclockeddev/ComfyUI-PreviewSubselection-Node
    

    Restart ComfyUI and you'll find it under the underclocked category in the node menu. That's the whole install.

    The honest take

    Two real caveats. First, the label is drawn with cour.ttf (Courier) and the code has no font fallback - on a stripped-down Linux box without Microsoft core fonts, a non-empty label can throw. Leave it blank or install the font. Second, don't expect it to fix results. If your regions come out butchered or collaged, that's a conditioning-blend problem (the regional-prompting crowd will tell you to end region masking early), and no preview node is going to solve it. What this one does solve is the dumb, expensive failure of not knowing where your boxes are until after a generation. For that, it's genuinely handy - and it's the closest thing to a free look at your regional layout without installing a whole bigger pack like Inspire Pack's Regional Prompt nodes.

    Categoryunderclocked

    Inputs (10)

    NameTypeDefaultDescription
    total_widthINT51264–8192
    total_heightINT51264–8192
    widthINT64–8192
    heightINT64–8192
    xINT0–8192
    yINT0–8192
    subselection_colorSTRINGred
    background_colorSTRING#444444
    labelSTRING
    preview_methodCOMBO2 options: Passthrough, Render Here

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE