Image Quilting
Turn a scrap of texture into a whole wall — no GPU, no model, no API
- src
- IMAGE
If you've got a small patch of something - a fabric swatch, a brick close-up, a tuft of grass - and you want a big believable sheet of the same thing, this is the node. No checkpoint, no LoRA, no VRAM to speak of. It's a 2001 SIGGRAPH algorithm (Efros & Freeman's Image Quilting for Texture Synthesis and Transfer) that bmad4ever reimplemented for ComfyUI with a pile of modern conveniences. It runs on CPU, it's reproducible when you keep the seed fixed, and it takes about thirty seconds to understand.
Why you'd reach for it
Diffusion models are great at "a texture that resembles this" and terrible at "more of this exact texture." Try to outpaint a patch of knit fabric with a sampler and you get mush or pattern drift after a few hundred pixels. Quilting is the opposite: it copies real pixels from your source and stitches them together so the seams don't show. Same texture, bigger canvas, guaranteed. That's your use-case list right there - tileable game assets, material maps, fabric mockups, or just blowing a small background up without smearing it.
How it works
The algorithm is simple and kind of elegant. The output canvas is divided into overlapping blocks of block_size. For each new block, the node searches your source image for the patch whose overlap region best matches what's already placed - a template match, done fast with OpenCV. From the patches within tolerance of the best match it picks one at random, which is what seed is for. Then it carves a minimum-cut path through the overlap so the joint isn't a hard edge. Block by block, the canvas fills out to scale× the source.
Only a few knobs actually matter:
- scale (default 4) - output size, source × this in each dimension.
- block_size (default 20) - the one you'll fight with. Too small and the texture can't stay continuous; too big and you get visible repeats and seams.
- overlap (default ~1/6) - how much each block overlaps the previous one. More overlap means better continuity and slower runs.
- tolerance (default 0.1) - the randomness dial. Low tolerance clings to the best match and can start copying the source verbatim; high tolerance avoids repetition but lets transitions get sloppy.
Output
A single IMAGE, ready for a preview node, a save node, or straight into the next stage of your pipeline. Nothing exotic.
Installing
Easiest via ComfyUI Manager - search for comfyui_quilting and install. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_quilting
# then from your ComfyUI python environment:
python -m pip install -e /path/to/ComfyUI/custom_nodes/comfyui_quilting
Restart ComfyUI. The core dependency, bmquilting (the author's separate algorithm library), installs automatically from its git repo. There's one optional extra: pyastar2d, which speeds up the minimum-cut step a little. Skip it if you want - on Windows it needs C++ build tools, and the pack is fully functional without it. No model files to download, no API keys, nothing.
Where people get burned
- Tolerance at zero is not the safe setting it sounds like. Too low and the node starts outputting the lookup texture as-is, seams and all. Keep it in the 0.05–0.2 range to start.
- Parallelization changes the output, not just the speed. Bump
parallelization_lvlabove 1 and you're getting a different result than the sequential run - and 2+ is often slower on small images. Leave it at 1 unless you're quilting something genuinely large. - Block size is the whole game. If a result looks wrong, change
block_sizebefore touching anything else. Or hand the image to the pack's Guess Quilting Block Size node and let it pick for you.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| src | IMAGE | — | |
| scale | FLOAT | 4.02–10 | — |
| block_size | INT | 203–256 | — |
| overlap | FLOAT | 0.170.1–0.9 | — |
| tolerance | FLOAT | 0.100.01–2 | — |
| parallelization_lvl | INT | 10–6 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |