Flux Kontext Pad For Outpaint
Pad an image to Flux's favorite resolution without the math
- image
- padded_image
- outpaint_mask
- original_width
- original_height
Outpainting on Flux has a chicken-and-egg problem: you want to extend a canvas, but the model generates best at its preferred resolutions, and your source image is almost never one of them. Flux Kontext Pad For Outpaint is the pack's fix - it scales your image and center-pads it up to the nearest Flux-friendly canvas, hands you the padded image plus a mask marking exactly what's new, and tells you the original dimensions so you can restore them afterward.
The name points at Kontext because that's the family this is built for. Flux Kontext is BFL's instruction-editing model - you feed it an image plus a sentence ("extend the scene to the left") and it edits in context. Instruction editors are the standard outpaint path these days: pad the canvas, tell the model to fill the padding, crop back. This node is the "pad the canvas" half, done the way Flux likes it.
How it works
The node takes your image, scales it, and pads it to the nearest preferred Flux resolution, returning four outputs:
- padded_image - the image sitting on the new canvas.
- outpaint_mask - the mask of what's padding: 0 is the original area, 1 is the padding. This is what tells the editor "fill here".
- original_width / original_height - your image's dimensions before the pad. You'll feed these straight into FluxRestoreAndCrop after generation to get your original canvas back.
The workflow is a tidy loop: pad → generate the outpaint → restore. FluxRestoreAndCrop is the node that closes it, and it's built to receive exactly these original_width/original_height values.
The inputs
- image - your source image. That's the only input. Everything else is computed.
This is one of the pack's most self-contained nodes: one input in, four outputs out, no tuning knobs. That's the right design for a step that should be deterministic.
Setup
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/PeterMikhai/Doom_Flux_NodePack
Restart ComfyUI, or search "DoomAI Nodes" in Manager. No extra dependencies - it's image math.
Where people get burned
- Mask polarity. 0 = original, 1 = padding, per the tooltip. If your edit model or conditioning node expects the opposite, invert the mask - one node away from fixed, but a silent no-op if you don't.
- It pads, it doesn't preserve pixels. The image gets scaled to fit the target canvas. If your workflow needs the original pixels byte-for-byte, the scaling step means they won't be - you're working with a resized original, not a copy. For most outpaints that's fine; for surgical edits it isn't.
- Forgetting the restore. The padded canvas is an intermediate state. If you save the
padded_imagethinking it's your final, you get black bars. Pair it with FluxRestoreAndCrop and you're done.
There's also the broader caveat that applies to all the Kontext-family tools: the FLUX.1 dev license (Kontext-era) bans NSFW LoRAs, and Kontext itself is censored at the weights. Fine for legitimate outpaint work; worth remembering if your workflow leans that way. As a node, though, this is the rare one that's smaller than its name - a clean, single-purpose pad, no surprises.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Исходное изображение |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| padded_image | IMAGE | Изображение с паддингом |
| outpaint_mask | MASK | Маска: 0 — исходная область, 1 — паддинг |
| original_width | INT | Ширина до паддинга |
| original_height | INT | Высота до паддинга |