abyz22_lamaPreprocessor
Let LaMa invent the border you're about to outpaint
- pixels
- vae
- LaMa Preprocessed Image
- LaMa Preprocessed Latent
- LaMa Image
Outpainting has a chicken-and-egg problem: you want to extend the image, but the sampler needs something in the new pixels to anchor on, and noise is a terrible anchor. The trick this node runs is to have LaMa pre-fill the empty border with plausible content, then let your sampler refine that guess. abyz22_lamaPreprocessor does exactly that - it pads your image on random sides, runs LaMa over the padded region, and returns a padded image, a latent, and the LaMa-filled result. It's the "Outpainting (LaMa)" feature from this pack's README, and it's also handy as a data-augmentation step for training.
It's the sibling of abyz22_lamaInpaint, both shipping the bundled LaMa implementation in abyz22/image_control. First run downloads the ControlNetLama.pth weights (~200 MB) from lllyasviel's Annotators on Hugging Face.
Inputs that matter
pixels- the source image (IMAGE).vae- needed to encode the padded result.Width,Height(each 0–2048, step 8) - the canvas size to pad up to. Both 0 is the special case: no padding, just encode the image as-is with a full noise mask.Width_Ratio_min/max,Height_Ratio_min/max(0–1, default 0.5) - how much of the padding goes on each side. The node picks a random split between min and max, so outpainting isn't always "extend right" - set min=max to force an even split, or use the range to vary it per run.seed- randomizes the split; same seed reproduces the same composition.
Outputs: LaMa Preprocessed Image (the padded, alpha-masked image for compositing), LaMa Preprocessed Latent (ready for a sampler), and LaMa Image (the LaMa fill as a plain image).
How it works
For each frame it picks a random up/down and left/right padding split, stamps the original into a random-noise canvas, builds a mask where the padding is "fill me," runs the bundled LaMa model on it, and stitches the result. Then it encodes the padded image and applies a noise mask so your KSampler regenerates the whole canvas rather than fighting an awkward seam. The "zoom out = pad, then sample, then crop back" workflow this enables is the modern, model-aware version of the old crop-and-stitch hack.
Install and gotchas
cd ComfyUI/custom_nodes
git clone https://github.com/abyz22/image_control
or ComfyUI Manager → "image_control", restart. First LaMa run downloads weights from Hugging Face. Requirements add openpyxl, pytorch-lightning, kornia; if imports fail at startup, check omegaconf/einops/yaml, which the pack uses but doesn't declare.
The main trap is canvas size: Width/Height are the target canvas, and if they're smaller than your input the math goes sideways - keep them at or above your image dimensions. And remember LaMa's fill is a starting guess, not a final answer; if you sample the latent at full denoise you get a brand-new border, at low denoise you get LaMa's guess with light polish. Low denoise is usually the better look for outpainting.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | — | |
| vae | VAE | — | |
| Width | INT | 00–2048 | — |
| Width_Ratio_min | FLOAT | 0.500–1 | — |
| Width_Ratio_max | FLOAT | 0.500–1 | — |
| Height | INT | 00–2048 | — |
| Height_Ratio_min | FLOAT | 0.500–1 | — |
| Height_Ratio_max | FLOAT | 0.500–1 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| LaMa Preprocessed Image | IMAGE | — |
| LaMa Preprocessed Latent | LATENT | — |
| LaMa Image | IMAGE | — |