# gizai/tasks/cutout

background removal. A model family that cuts the subject out of a picture gives a Cutter (gizai/family's `cutout`): its GPU, and `alpha`, the subject's alpha at the picture's size. `giz ai cutout`, a worker (cutoutService: operation image.cutout) and a program use every such model so.

```gizlang
import * as Cutout from "gizai/tasks/cutout";
```

## Types

### `Cutter`

```gizlang
type Cutter = { gpu: Gpu; alpha: (picture: Img.Image) => bytes throws string; }
```

What a family gives: the card it loaded on, and `alpha`, the subject's alpha of `picture` (one byte a pixel at the
picture's size, 255 the subject).

- `gpu`: `M7.Gpu`
- `alpha`: `(picture: gizlang_image.Image) => bytes throws string`

## Functions

### `cut`

```gizlang
function cut(c: Cutter, picture: bytes): bytes throws string
```

`picture` (a JPEG, PNG or WebP file's bytes) with its background transparent: a PNG of its RGB and the subject's
alpha.

Effects: fail, read, write, console, io, alloc.

### `cutoutService`

```gizlang
function cutoutService(name: string, load: (gpu: Gpu) => Cutter throws string, capacity: i64 = 4): Hosting.Service
```

The service of cutout model `name` as giz's inference worker: operation image.cutout, `capacity` jobs held; `load`
makes the model on the host's GPU. A job's input: `image` (an uploaded picture); its result is cutout.png.

Effects: fail, read, write, console, io, alloc.

