# Despill

> Removes green or blue spill by limiting the screen channel to what the other two allow: their average (balance) or their maximum (limit).

| Node | Despill |
|---|---|
| Menu | Keyer › Despill |
| **Names in each format** | |
| .oink comp (JSON) | `"type": "OC_N_despill"` |
| .nk script | `Despill` ([how .nk import works](/docs/nuke-users/nk-import)) |
| Python | `nuke.createNode("Despill")` |
| Assistant (MCP) | `create_node(type="Despill")` |
| Tab search | `despill` |

![Despill properties](/shots/nodes/despill@2x.webp)

## Inputs and outputs

| Port | Name | Type |
|---|---|---|
| input 0 | Image | image |
| input 1 | mask | image |
| output 0 | Image | image |

## Knobs

Panel tab **Despill**, in panel order.

| Knob | Label | Type | Default | Range / values | .nk knob | Description |
|---|---|---|---|---|---|---|
| `channels` | channels | menu | `rgb` | rgba, rgb, alpha, all, none |  | Layer the op applies to: rgb, rgba, alpha, all, none, <layer> or <layer>.<ch> |
| `screen_type` | screen | menu | `green` | green, blue | `screen_type` | green or blue. |
| `method` | method | menu | `average` | average, limit | `method` | average (balance mix of the other two) or limit (the larger of them). |
| `balance` | balance | float | `0.5` | 0 to 1 | `balance` | weight of red in the average. |
| `amount` | amount | float | `1` | 0 to 1 | `amount` | how much of the spill to remove. |
| `restore_luminance` | restore luminance | bool | `false` |  | `restore_luminance` | add the removed brightness back to all channels. |
| `mask_channel` | mask | menu | `none` | none, rgba.alpha, rgba.red, rgba.green, rgba.blue |  | Mask channel, e.g. rgba.alpha (none = no mask) |
| `inject` | inject | bool | `false` |  |  | Copy the mask into mask.a for nodes downstream |
| `invert_mask` | invert | bool | `false` |  | `invert_mask` |  |
| `fringe` | fringe | bool | `false` |  |  | Only apply the effect at the edges of the mask |
| `unpremult` | (un)premult by | menu | `none` | none, rgba.alpha |  |  |
| `invert_unpremult` | invert | bool | `false` |  |  | (Un)premultiply by 1 - alpha |
| `mix` | mix | float | `1` | 0 to 1 | `mix` |  |

### Other knobs (Python, .nk and the assistant; not on the panel)

| Knob | Label | Type | Default | Range / values | .nk knob | Description |
|---|---|---|---|---|---|---|
| `gl_color` | Viewer Controls Color | float ×3 | `0, 0, 0` | 0 to 1 |  |  |
| `postage_stamp_frame` | Static Frame | int | `1` | -2147483648 to 2147483647 |  |  |
| `lifetimeStart` | Lifetime Start | int | `0` | -2147483648 to 2147483647 |  |  |
| `lifetimeEnd` | Lifetime End | int | `100` | -2147483648 to 2147483647 |  |  |
| `useLifetime` | Use Lifetime | boolean | `false` |  |  |  |
| `cached` | Cached | boolean | `false` |  |  |  |
| `bookmark` | Bookmark | boolean | `false` |  |  |  |
| `dope_sheet` | Dope Sheet | boolean | `false` |  |  |  |
| `clone_group` | Clone Group | string |  |  |  |  |
| `link_source` | Link Source | string |  |  |  |  |
| `link_overrides` | Link Overrides | string |  |  |  |  |
| `split_views` | Split Views | string |  |  |  |  |

## Examples

Open these from **Help › Examples…**, or from the **?** menu in this node's Properties panel.

- **Greenscreen: ScreenKey, Despill, comp over a sky** (`examples/keying/greenscreen_key_despill.oink`): Tears of Steel plate 08_3a (CC BY 3.0, Blender Foundation, mango.blender.org): an actor on a green screen that falls off towards the frame edges. ScreenKey pulls the key from a screen colour picked over the open screen (Ctrl+click or Ctrl+Shift+drag in the Viewer with its panel open), with screen gain 1.1 and clip black / white 0.1 / 0.9 for the uneven screen; its own despill is off so the Despill node (average) does it. The premultiplied result goes over a Poly Haven sky (CC0) reformatted to the plate. The same chain ships as the Keying ToolSet.


---
Sources: opencomp_core/nodes/keyer/despill.py, opencomp_electron/src/components/properties/knobSchema.ts, opencomp_core/nodes/help/despill.md, opencomp_core/nk/mapping.py
