Nodes/ComfyUI-Koolook/Koolook Matte — Focus Stitch
ComfyUI Node

Koolook Matte — Focus Stitch

Koolook Matte's Focus Stitch

By malkuthro·Created 11 months ago·Updated a day ago· 8
Koolook Matte — Focus Stitch
  • focus
  • cropped_mask
  • mask

Focus Stitch is the other half of Koolook Matte's two-pass crop trick. Focus Crop shrinks the frame down to the subject so the expensive matting runs on a manageable image; Focus Stitch takes the finished crop matte and pastes it back into the full frame at the exact right position. Two inputs, one output, no settings to mess up - it's the least fiddly node in the Matte family, which is rare for this pack's heavy corner.

It's also the node that makes the whole focused approach usable. If you matte the crop and then eyeball the paste-back yourself, you'll be off by a few pixels and the comp will look wrong in every frame. The stitch exists because the geometry bookkeeping (where the crop started, how the padding shifted it, whether max_long_side downscaled things) is exactly the kind of math you don't want to redo by hand per frame.

How it works

It takes two inputs:

  • focus - the custom FOCUS object from Focus Crop, which carries the crop geometry.
  • cropped_mask - the matte output from the segmentation/matte sampler, still in crop space.

And it returns one thing: mask, the full-frame matte aligned to the original image dimensions. If you disabled Focus Crop (enabled off), the crop is an identity pass and the stitch is equally a no-op - the pipeline just becomes single-pass full-frame, and this node still works as the terminal output. It's built so the wiring doesn't change when you flip the two-pass switch.

Where it fits

The canonical Matte graph is:

images → Focus Crop → cropped_images → Sampler → MASK → Focus Stitch → mask
                    ↘ coarse_mask     ↗

Your coarse mask drives the crop; the sampler does the mask-guided matting on the crop; the stitch hands you a full-frame alpha you can feed to a compositing node, a keyer, or a save. If you're coming from the background-removal world, this is the "put it back on the plate" step that turns a cutout into an actual matte for a shot.

Install

Part of the Koolook pack. ComfyUI Manager → Install Custom Nodes → Git URL:

https://github.com/malkuthro/ComfyUI-Koolook.git

Or:

cd ComfyUI/custom_nodes
git clone https://github.com/malkuthro/ComfyUI-Koolook.git

Restart, and it's under Koolook Matte. The Matte group's dependencies (diffusers, huggingface_hub, and the SVD + VideoMaMa weights downloaded at runtime by the Loader) all apply here too - this node itself does pure tensor pasting, but it won't do anything useful without the pipeline. And the pack rule: install once. Two installs (Manager's custom_nodes/koolook/ plus a clone) load both and corrupt the workflow store on every boot until you remove one.

Common issues

  • Mask doesn't line up with the frame - the focus and cropped_mask aren't from the same Focus Crop run, or you mixed crops between frames. Keep the pair together; the stitch trusts the geometry it's given.
  • "I only have the crop, no focus object" - then you can't stitch. The stitch is useless without its Focus Crop sibling. If you skipped the crop entirely, wire the Sampler's full-frame output straight out instead.
  • Looks like a no-op - that's correct behavior when Focus Crop had enabled off. The identity path is by design.
CategoryKoolook Matte

Inputs (2)

NameTypeDefaultDescription
focusFOCUS
cropped_maskMASK

Outputs (1)

NameTypeDescription
maskMASK