Koolook Matte — Focus Crop
Koolook Matte's Focus Crop
- images
- coarse_mask
- cropped_images
- cropped_mask
- focus
Matting models are hungry. Feed them a full 4K frame and they'll eat your VRAM and give you a soft, smeary edge anyway, because the subject only occupies a fraction of the pixels. Focus Crop is the first half of the Koolook Matte pack's answer: crop to the subject, run the expensive matting on the crop at native resolution, then stitch the result back. It's a two-pass strategy for people who can't afford to matte whole frames.
The node takes your images plus a coarse_mask - a rough subject mask from any segmentation source, like BiRefNet or a manual pass - and finds the union bounding box. Around that box it adds padding (24 pixels by default) and crops. That cropped_images / cropped_mask pair feeds the downstream segmentation and matte model at a resolution your GPU can actually handle.
The inputs that matter
- coarse_mask - the rough mask defining where the subject is. This is the input that does the work; everything else is tuning.
- padding - margin around the subject's bounding box. The tooltip has the real warning: thin appendages (claws, tails) need room so they fall inside the crop, "otherwise they can't be recovered downstream." Under-pad and you get a subject with its tail amputated. Default 24 is a starting point, not a guarantee.
- max_long_side - the VRAM safety cap. If the native crop's longest side exceeds this (default 2560), the crop gets downscaled to fit, aspect preserved, never upscaled. This is the number that bounds what both the segmentation and matte model actually process. The tooltip's rule of thumb: 2560 comfortably fits a 24GB card; 0 means no cap.
- enabled - the master toggle. ON runs the focused two-pass. OFF passes the full frame through unchanged (identity focus), so downstream runs single-pass full-frame. Promote
enabledto a subgraph and you get a one-click two-pass switch for comparing quality and VRAM cost.
Outputs
Three, and they wire as a set: cropped_images, cropped_mask, and focus - the custom FOCUS type that carries the crop geometry. The focus + cropped_mask go to Focus Stitch, which pastes the finished matte back into the full frame. Don't try to bypass the stitch with the crop alone; you'd get a matte that doesn't line up with the original frame.
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. This is the pack's heavy corner: the Matte nodes need diffusers and use huggingface_hub to download the SVD + VideoMaMa weights at runtime (details on the Loader page). First run will download a lot. And the standing rule: install the pack once - a Manager install at custom_nodes/koolook/ plus a git clone copy double-registers and corrupts the workflow store on every boot.
Common issues
- Amputated subject edges -
paddingtoo small. Give thin appendages room; the tooltip is explicit that under-cropping is unrecoverable. - OOM during the matte pass - raise
max_long_sidedown (i.e. lower the cap), or switch the Sampler'sresize_mode. Focus Crop bounds the area both stages process, so this is the first knob to turn. - Identity pass is slow - you toggled
enabledoff and forgot. That's the full-frame single-pass mode, and it's meant for comparison, not as the default.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| coarse_mask | MASK | — | |
| padding | INT | 240–1024 | Pixels of margin around the subject's union bounding box. Give thin appendages (claws, tails) room so they fall INSIDE the crop, otherwise they can't be recovered downstream. |
| max_long_side | INT | 25600–8192 | VRAM safety cap: if the native crop's LONGEST side exceeds this, downscale the crop to fit (aspect kept). Never upscales. This same cropped image feeds BOTH the segmentation and the matte model, so it bounds the area both process. 0 = no cap (native crop). 2560 comfortably fits a 24GB card. |
| enabled | BOOLEAN | true | Master toggle for the focused two-pass. ON = crop to the subject, process at native res, stitch back. OFF = pass the FULL frame straight through unchanged (identity focus), so the downstream seg/matte run single-pass full-frame. Promote this to a subgraph to get a one-click two-pass switch. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| cropped_images | IMAGE | — |
| cropped_mask | MASK | — |
| focus | FOCUS | — |