# Transform

> Move, scale, rotate, crop and mirror a stream, and set the output size. Also the resize node.

Source: https://docs.tune.toys/nodes/video.transform/

Transform moves, scales, rotates, crops and mirrors a stream, and sets its output size.

## What it does

Position, scale, rotation and crop change how the picture sits inside the frame. Width and Height set the output size; 0 keeps the input size, so it is also the resize node. It processes every stream of the input at that stream's size and keeps the stream count.

## When to use it

Use it to fit a source to a layout, flip a camera, or shrink a stream before a [Composite](https://docs.tune.toys/nodes/video.composite/).

## Ports

<!-- ports:start -->

| Port    | Direction | Signal | Lanes                   |
| ------- | --------- | ------ | ----------------------- |
| `video` | Input     | Video  | Inferred from the cable |
| `video` | Output    | Video  | Inferred from the cable |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter  | Label    | Range       | Default | Unit | Scale  | Notes                                                |
| ---------- | -------- | ----------- | ------- | ---- | ------ | ---------------------------------------------------- |
| `x`        | X        | -1 to 1     | 0       |      | linear | Horizontal offset as a fraction of the output width. |
| `y`        | Y        | -1 to 1     | 0       |      | linear | Vertical offset as a fraction of the output height.  |
| `scale`    | Scale    | 0.05 to 8   | 1       | ×    | log    | Uniform scale about the centre.                      |
| `rotation` | Rotation | -180 to 180 | 0       | °    | linear | Rotation about the centre.                           |
| `crop`     | Crop     | 0 to 0.49   | 0       |      | linear | Fraction trimmed from every edge before scaling.     |
| `mirror_h` | Mirror   | 0 to 1      | 0       |      | linear | Flip horizontally. Choices: 0 Off, 1 On.             |
| `mirror_v` | Flip     | 0 to 1      | 0       |      | linear | Flip vertically. Choices: 0 Off, 1 On.               |
| `width`    | Width    | 0 to 3840   | 0       | px   | linear | Output width in pixels; 0 keeps the source width.    |
| `height`   | Height   | 0 to 2160   | 0       | px   | linear | Output height in pixels; 0 keeps the source height.  |

<!-- parameters:end -->

### X (`x`)

Horizontal offset from -1 to 1.

### Y (`y`)

Vertical offset from -1 to 1.

### Scale (`scale`)

Zoom from 0.05 to 8 times; 1 is unchanged. Logarithmic.

### Rotation (`rotation`)

Rotation in degrees.

### Crop (`crop`)

Trims each edge, from 0 to 0.49 of the picture.

### Mirror (`mirror_h`)

Flips the picture left to right when on.

### Flip (`mirror_v`)

Flips the picture top to bottom when on.

### Width (`width`)

Output width in pixels; 0 keeps the input width.

### Height (`height`)

Output height in pixels; 0 keeps the input height.

## Tips

- Set Width and Height once to fix a Toy's output size.
- Video needs the browser's WebGPU video engine. The Player and exports do not run video yet and report it unavailable. To see a video output, bind a live Screen in the Frame to it.

## See also

[Composite](https://docs.tune.toys/nodes/video.composite/), [Pixelate](https://docs.tune.toys/nodes/video.pixelate/), [Camera](https://docs.tune.toys/nodes/video.camera/), [Video](https://docs.tune.toys/concepts/video/), [Control lanes](https://docs.tune.toys/concepts/control-lanes/).
