# Grain

> Synthetic film grain.

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

![Grain properties](/shots/nodes/grain@2x.webp)

## Inputs and outputs

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

## Knobs

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

| Knob | Label | Type | Default | Range / values | .nk knob | Description |
|---|---|---|---|---|---|---|
| `seed` | seed | float | `134` | -1000 to 1000 (integer) | `seed` |  |
| `presets` | presets | menu | `Kodak 5248` | Kodak 5248, other | `presets` |  |
| `red_size` | red | float | `3.3` | 0 to 100 | `red_size` |  |
| `green_size` | green | float | `2.9` | 0 to 100 | `green_size` |  |
| `blue_size` | blue | float | `2.5` | 0 to 100 | `blue_size` |  |
| `red_i` | red | float | `0.6` | 0 to 1 | `red_i` |  |
| `green_i` | green | float | `0.6` | 0 to 1 | `green_i` |  |
| `blue_i` | blue | float | `0.6` | 0 to 1 | `blue_i` |  |
| `red_m` | red | float | `0.416` | 0 to 1 | `red_m` |  |
| `green_m` | green | float | `0.46` | 0 to 1 | `green_m` |  |
| `blue_m` | blue | float | `0.85` | 0 to 1 | `blue_m` |  |
| `black` | black | float | `0` | 0 to 0.1 | `black` |  |
| `minimum` | minimum rgb | colour ×3 | `0, 0, 0` | 0 to 1 | `minimum` |  |
| `maskgrain` | Apply only through alpha | bool | `true` |  | `maskgrain` |  |
| `invert_mask` | Invert alpha | bool | `false` |  | `invert_mask` |  |
| `match_from` | grain from | text |  |  |  |  |
| `match_shot` | Match shot | button (panel only) |  |  |  |  |
| `match_info` |  | info |  |  |  |  |

### 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 |  |  |  |  |


---
Sources: opencomp_core/nodes/draw/grain.py, opencomp_electron/src/components/properties/knobSchema.ts, opencomp_core/nk/mapping.py
