Nodes/lzits Nodes/Image Outpaint (Color Canvas)
ComfyUI Node

Image Outpaint (Color Canvas)

Fill the new canvas with a color

By lzitser23·Created 9 months ago·Updated 3 months ago· 0
Image Outpaint (Color Canvas)
    • image
    • outpaint_mask
    image
    expand_left0
    expand_right0
    expand_top0
    expand_bottom0
    background_color#ffffff

    Outpaint flows in ComfyUI have a boring first step that everyone hand-rolls: load an image, make a bigger canvas, paste the image into it, and keep track of which pixels are new. Image Outpaint (Color Canvas) does that in one node - and, more usefully, hands you the mask that marks the new region. In a classic mask-based outpaint pipeline, that mask is the thing you actually needed.

    How it works

    The node reads the uploaded image, builds a canvas sized to source + expand_left + expand_right + expand_top + expand_bottom, pastes the original at the offset, and fills everything else with your chosen color. Two outputs come out:

    • image (IMAGE) - the enlarged canvas with the original untouched inside it.
    • outpaint_mask (MASK) - 1.0 across the outpainted area, 0.0 over the original. Invert it (or not, depending on your node's convention) and feed it to the mask/inpaint conditioning for whatever model you're using.

    It can only grow, never shrink - every expand value floors at 0. The node also hashes the image file and all its widget values, so changing background_color correctly invalidates the cache instead of serving a stale result.

    The inputs that matter

    • image - upload directly in the node's file picker.
    • expand_left / right / top / bottom - pixels added on each side, 0–8192.
    • background_color - the fill color. Parsing is friendly: #RRGGBB, #RGB, r,g,b (either 0–255 or 0–1), or names like white, black, red, green, blue, gray.

    A bad color string fails validation with a clear message before the graph runs, not in the middle of it.

    Why a solid color, and which one

    Diffusers inpaint from the boundary - the fill color is part of the context the sampler sees, so it affects how the extension blends. Pure black or pure white both work, but a color close to the edge you're extending (or a mid-gray) tends to give the sampler an easier starting point. The common workflow: expand the canvas with a color, run the mask through your inpaint conditioning, and let the model redraw the new region while the original stays pixel-identical.

    The KB's inpainting essay is blunt that instruction-editing models have displaced a lot of mask-based work since 2025 - but for "extend the image and leave the rest untouched," the mask approach still wins, because edit models redraw the whole frame. This node is the setup step for that path.

    Installing this node

    One of the 16 nodes in the lzits Nodes pack (Lior Zitser, MIT). Install the pack once via ComfyUI Manager (search "lzits Nodes") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lzitser23/lzits-nodes.git
    

    Restart ComfyUI. This node needs nothing beyond what ComfyUI ships - PIL, numpy, torch.

    Categorylzits nodes

    Inputs (6)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    expand_leftINT00–8192
    expand_rightINT00–8192
    expand_topINT00–8192
    expand_bottomINT00–8192
    background_colorSTRING#ffffff

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    outpaint_maskMASK