TTP_Expand_And_Mask
Pad a canvas and get the outpaint mask for free
- image
- EXPANDED_IMAGE
- MASK
This one isn't documented in the pack's README at all - it's not mentioned in any of the feature sections - so everything here is read directly off what the node exposes. It's a canvas-extension helper: grow your image's edges outward and get back both the bigger image and a mask marking exactly which pixels are new, which is precisely the setup step every outpainting workflow needs before you hand it to a sampler.
Why you'd want this. Outpainting - extending an image beyond its original borders - almost always starts with this same two-step move: pad the canvas with something, then generate a mask that says "everything in the padded region is fair game, everything inside the original photo is not." The community's own version of this trick, with a plain image-pad node, is to pad each side with a flat color and prompt an edit model to "remove the padding and show what's behind it." TTP_Expand_And_Mask bundles that padding-plus-masking step into one node instead of you wiring an image-pad node and a separate mask-generation node together.
The inputs that matter. You pick which sides to grow with four booleans - expand_left, expand_right, expand_top, expand_bottom, all off by default - and how far to grow each one with matching num_blocks_left/right/top/bottom controls (0–3, default 1). fill_mode decides what goes in the new space: duplicate (repeats the edge pixels outward, a soft, blend-friendly fill) or white (a flat fill). There's also a fill_color string (default a mid-gray, #7F7F7F) and a fill_alpha_decision boolean sitting alongside the fill mode - between them they give you control over the flat-fill color and how it treats alpha, though the exact interaction with fill_mode's two named options isn't spelled out anywhere I could verify, so if you need a specific fill color, just set fill_color and check the result rather than assuming.
Outputs: EXPANDED_IMAGE (the padded canvas) and MASK (white where the new padding is, presumably black over the original image - feed this straight into an inpaint/outpaint sampler pass or an InpaintModelConditioning-style node).
Install. ComfyUI Manager, search "Comfyui_TTP_Toolset", or cd ComfyUI/custom_nodes && git clone https://github.com/TTPlanetPig/Comfyui_TTP_Toolset, then restart. Pure image manipulation - no model downloads, no extra dependencies.
Common issues. Since this node isn't in the README, there's no documented troubleshooting to lean on, so take the following as informed defaults rather than confirmed fixes. If your outpaint result has a visible seam where the original image meets the new region, try fill_mode=duplicate instead of white - a flat white or gray edge gives the sampler nothing to blend from, while duplicated edge pixels at least give it a texture gradient to work with. If you're chasing a specific final resolution and the num_blocks_* controls (capped at 3 per edge) don't get you there in one pass, run the node twice - expand, sample, expand again - rather than assuming a higher block count than the max exists.
One thing worth remembering from the wider outpainting playbook: masked outpainting (mask stays byte-identical outside the region, sampler only touches the padded area) is still the right tool when the original pixels genuinely must not drift, which is exactly what pairing this node's MASK output with a proper inpaint-conditioned sampler gets you - as opposed to a whole-frame instruction-edit model, which will happily redraw the entire image, original content included, whether you wanted that or not.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| fill_mode | COMBO | duplicate | 2 options: duplicate, white |
| fill_alpha_decision | BOOLEAN | false | — |
| fill_color | STRING | #7F7F7F | — |
| expand_leftopt | BOOLEAN | false | — |
| expand_rightopt | BOOLEAN | false | — |
| expand_topopt | BOOLEAN | false | — |
| expand_bottomopt | BOOLEAN | false | — |
| num_blocks_leftopt | INT | 10–3 | — |
| num_blocks_rightopt | INT | 10–3 | — |
| num_blocks_topopt | INT | 10–3 | — |
| num_blocks_bottomopt | INT | 10–3 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| EXPANDED_IMAGE | IMAGE | — |
| MASK | MASK | — |