# ScreenKey

> Green / blue screen keyer with the controls of a Keylight-style keyer: screen colour, gain and balance, clip black / white, shrink / grow, softness, despill with bias, and inside / outside masks.

Green / blue screen keyer with the controls of a Keylight-style keyer: screen colour, gain and balance, clip black / white, shrink / grow, softness, despill with bias, and inside / outside masks. Keylight and Primatte nodes in a .nk open as ScreenKey.

| Node | ScreenKey |
|---|---|
| Menu | Keyer › ScreenKey |
| **Names in each format** | |
| .oink comp (JSON) | `"type": "OC_N_screenkey"` |
| .nk script | `ScreenKey`, also imports `OFXuk.co.thefoundry.keylight.keylight_v201`, `OFXuk.co.thefoundry.keylight.keylight_v200`, `Keylight` ([how .nk import works](/docs/nuke-users/nk-import)) |
| Python | `nuke.createNode("ScreenKey")` |
| Assistant (MCP) | `create_node(type="ScreenKey")` |
| Tab search | `screenkey`, or its initials `sk` |

![ScreenKey properties](/shots/nodes/screenkey@2x.webp)

## Usage
1. Open the panel and Ctrl+Shift+drag over the screen in the Viewer (Ctrl+click picks one pixel).
   The colour is taken from the Source input.
2. View Status: white is solid, black clear, grey partial. Raise screen gain or clip black to
   clean the background, lower clip white to fill the foreground.
3. Connect a garbage matte to OutM and a holdout to InM.
The output is premultiplied (screen subtracted, spill removed); merge it over the background, or
connect the background to Bg.

## Inputs and outputs

| Port | Name | Type |
|---|---|---|
| input 0 | Source | image |
| input 1 | Bg | image |
| input 2 | InM | image |
| input 3 | OutM | image |
| output 0 | Image | image |

## Knobs

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

| Knob | Label | Type | Default | Range / values | .nk knob | Description |
|---|---|---|---|---|---|---|
| `view` | View | menu | `final` | final (Final Result), intermediate (Intermediate Result), screen_matte (Screen Matte), status (Status), source (Source) |  | Final Result, Intermediate Result (unpremultiplied), Screen Matte, Status, Source. |
| `screen_colour` | Screen Colour | colour ×3 | `0, 0, 0` | 0 to 1 |  | the picked screen colour (black, the default, keys nothing). |
| `screen_gain` | Screen Gain | float | `1` | 0 to 2 |  | more gain removes more screen. |
| `screen_balance` | Screen Balance | float | `0.5` | 0 to 1 |  | weight of the first of the two other channels in the colour difference. |
| `pre_blur` | Pre-blur | float | `0` | 0 to 10 |  | blurs the source for the matte only (grain, compression). |
| `edge_refine` | Edge Refine | bool | `true` |  |  | solves the edge alpha against the foreground colour next to it. |
| `clip_black` | Clip Black | float | `0` | 0 to 1 |  |  |
| `clip_white` | Clip White | float | `1` | 0 to 1 |  |  |
| `shrink_grow` | Shrink/Grow | float | `0` | -20 to 20 |  | erode (negative) or dilate (positive) the matte, in pixels. |
| `softness` | Softness | float | `0` | 0 to 20 |  | blur of the matte, in pixels. |
| `despill` | Despill | float | `1` | 0 to 1 |  | how much of the leftover spill to remove. |
| `despill_bias` | Despill Bias | colour ×3 | `0.5, 0.5, 0.5` | 0 to 1 |  | a colour the despill must leave unchanged (e.g. a skin tone). |
| `premultiply` | Premultiply | bool | `true` |  |  | premultiplied output (off = unpremultiplied colour with the alpha). |

### 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/screenkey.py, opencomp_electron/src/components/properties/knobSchema.ts, opencomp_core/nodes/help/screenkey.md, opencomp_core/nk/mapping.py
