Nodes/PortraitUtils/Outpaint Config
ComfyUI Node

Outpaint Config

Store your outpainting preferences once, hand them out everywhere

By heyburns·Created 11 months ago·Updated 4 months ago· 1
Outpaint Config
    • mode
    • gravity
    • horizontal_percent
    • vertical_percent
    • left_px
    • right_px
    • top_px
    • bottom_px
    modePercent
    gravitycenter
    horizontal_percent20.0
    vertical_percent10.0
    left_px0
    right_px0
    top_px0
    bottom_px0

    Outpainting has a configuration problem: how much to extend each side, and in which direction, is a decision you make once and then want applied consistently across every frame of a batch. Retyping "extend 20% horizontally, 10% vertically, anchor center" into a half-dozen nodes is how batches end up with inconsistent borders. OutpaintConfigNode is the pack's settings holder for exactly that - set it once, get all the values out as typed wires.

    The inputs: mode (Percent or Pixels), gravity (nine choices - center, the four edges, and the four corners), horizontal_percent (default 20) and vertical_percent (default 10) for percentage-based padding, and left_px/right_px/top_px/bottom_px for pixel-based padding. The outputs are literally all of those, in the same names and types - mode and gravity as strings, the percents as floats, the px values as ints. Nothing is computed; it mirrors your settings into clean wires for the nodes that actually do math.

    That math is OutpaintPaddingComputeNode's job: it takes this config (or any wires in the same shape) plus an image, and turns "20% horizontal, 10% vertical, gravity bottom" into exact pixel padding values. So the flow is: set preferences here once → feed them to the compute node → feed its pixel outputs to your padding/outpainting node. If you change your mind about how aggressive the outpaint should be, you edit one node and the whole branch follows.

    Why percent + gravity? Because "extend the scene down" isn't the same as "add 200px to the bottom" - it depends on the image's actual size. Percent mode scales with the image; gravity decides which side the extension pushes out from, which matters for whether you're extending the ground, the sky, or both. If you're processing a folder of scans at wildly different resolutions, percent mode is the one that stays sane across the batch.

    Install

    Manager → search "PortraitUtils", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heyburns/PortraitUtils
    

    Restart. No extra dependencies - it's a config mirror.

    Common issues

    • Node outputs nothing useful - it's config, not an image node. Its outputs are strings/ints/floats; wire them into the compute node or a log.
    • Percent mode behaves like pixels - check the mode output actually says Percent; if it's wired from a stale config the type might be wrong.
    • Gravity doesn't seem to do anything - gravity only matters once the compute node translates it into padding. If you're feeding px values directly downstream, gravity was never part of the calculation.

    It's a thin node, but it's the difference between "tweak outpaint in one place" and "hunt for the same number in five nodes." For batch outpainting, that's worth having.

    CategoryPortraitUtils/Config

    Inputs (8)

    NameTypeDefaultDescription
    modeCOMBOPercent2 options: Percent, Pixels
    gravityCOMBOcenter9 options: center, left, right, top, bottom, top left, +3
    horizontal_percentFLOAT20.00–10000
    vertical_percentFLOAT10.00–10000
    left_pxINT00–1000000
    right_pxINT00–1000000
    top_pxINT00–1000000
    bottom_pxINT00–1000000

    Outputs (8)

    NameTypeDescription
    modeSTRING
    gravitySTRING
    horizontal_percentFLOAT
    vertical_percentFLOAT
    left_pxINT
    right_pxINT
    top_pxINT
    bottom_pxINT