ComfyUI Node

ImagePadding

Give your images breathing room before outpaint, tiling, or compositing

By oyvindg·Created 3 years ago·Updated 2 years ago· 4
ImagePadding
  • image
  • image
padding0
blur0.0
color

The name is boring; the use isn't. ImagePadding slaps a border around an image - solid black, solid white, or fully transparent - and optionally blurs it. That one trick quietly unlocks a surprising amount of real workflow: outpainting, square-canvas prep, compositing margins, and tiling experiments.

Outpainting is the classic. A model can't extend an image into nothing; it needs canvas room to work with. Pad first, let the model generate into the border, then crop the finished border back off. A lot of that job has drifted to whole-frame instruction editors these days, but mask-and-crop outpaint still owns bit-identical pixels outside the region - and it starts with a padded canvas. Padding also rescues you when a model or tile scheme wants a square-ish input and your image is a wide panorama.

How it works

Straight Pillow ImageOps.expand() under the hood: the border gets filled with a flat color (or transparent pixels) and your content is untouched. Then, if you set a blur radius, a Gaussian blur runs over the whole result - which is the sneaky part, below.

The inputs that matter

  • padding (default 0, up to 8192) - border width in pixels. This is added to all four sides, so your image becomes (width + 2×padding) × (height + 2×padding). A 1024×1024 with padding 512 becomes 2048×2048, and memory grows with it. For "breathing room" you usually want tens of pixels, not hundreds.
  • color - black, white, or transparent. Transparent is the interesting one: the image is converted to RGBA and the border filled with fully transparent pixels, so the output carries an alpha channel.
  • blur (0–50) - softens the hard seam between content and border, which helps hide the boundary when you outpaint into it. Read the gotcha first.

Output

Just the one image, padded and ready for a VAE, a sampler's latent, or a composite node.

The gotcha nobody tells you

blur is applied to the entire image, not just the border. It's a feather over the whole frame, not a border-only soften. A radius of 1–3 barely touches your content and smooths the seam nicely; a radius of 10+ will visibly soften the original pixels too. Keep it small and you're fine - this is the classic mask-blur trick for hiding inpaint seams, applied to the whole canvas instead of the edge.

Installing

This ships in ComfyUI-TrollSuite, a five-node utility pack by Øyvind (oyvindg on GitHub). No models, no downloads - install it once and all five nodes appear under the TrollSuite/ submenus.

  • ComfyUI Manager → search "ComfyUI-TrollSuite" → Install → restart.
  • Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/oyvindg/ComfyUI-TrollSuite

then restart ComfyUI.

Troubleshooting

The transparent output has four channels, and a few nodes quietly assume RGB - if something downstream complains or colors go weird, run the result through a Convert Image / drop-alpha step first. And remember the output canvas is bigger than the input: if you're padding to feed a fixed-resolution model, double-check you're not accidentally doubling your latent size and your VRAM bill at the same time.

For fancier padded outpaint with automatic border inpainting, Impact Pack's UltimateSDUpscale or a dedicated outpaint workflow is smarter. ImagePadding is the lightweight version: predictable, no surprises, one knob.

CategoryTrollSuite/image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
paddingINT00–8192
blurFLOAT0.00–50
colorCOMBO3 options: black, white, transparent

Outputs (1)

NameTypeDescription
imageIMAGE