# fs.image.chromakey

Make a green screen transparent

# fs.image.chromakey

```
fs.image.chromakey --from IMAGE [--color TEXT] [--tolerance N] [--soften N] [--format png|webp] [--delete-source] [--store TEXT] [--folder TEXT] [--filename TEXT] [--path TEXT] [--on-conflict error|skip|overwrite] → image
```

Make a green screen transparent. Reads the image `--from` names — a FileRef, an upload or a store key — turns every pixel within `--tolerance` of `--color` (default #00b140, broadcast chroma green — what image models produce for "green screen") transparent with a `--soften` ramp at the edge and despill, writes `--format png|webp` (both keep alpha) under `--folder` (default `cutouts/`) and adds `image` — a durable FileRef with `width`, `height`, `format`, `source_deleted` — keeping the rest of the payload. No model: plain pixel maths. Generate the picture on a flat green background, then place the cutout in a poster with [`fs.image.render`](/nodes/fs/fs.image.render.md) as `<image href="<image.ref>">`.

## Flags

- `--from` (required): The image: a FileRef, an upload or a store key.
- `--color`: Key colour as #rrggbb (default: #00b140, broadcast chroma green).
- `--tolerance`: RGB distance from the key that is fully transparent, 0–441 (default: 60).
- `--soften`: Distance beyond --tolerance over which the edge ramps to opaque (default: 40).
- `--format`: png (default) or webp; both keep alpha.
- `--delete-source`: Delete the source once the cutout is written.
- `--store`: The project store to write to: `local`, or the id of an `s3` credential. Saved explicitly when the pipeline is registered (default: the project's default store at that moment)
- `--folder`: Destination folder (default: cutouts).
- `--filename`: Destination name without extension (default: a generated name).
- `--path`: Exact destination key; overrides --folder and --filename.
- `--on-conflict`: When the target already exists: overwrite, skip or error (default: error)

## Examples

### A generated character, cut out for a poster

```
| fs.image.chromakey --from "{{ input.file }}" --folder sandbox/posters/cutouts --preview image
```

The picture was generated "standing on a solid flat bright green chroma key background"; the default key #00b140 is what the model paints. Then [`fs.image.render`](/nodes/fs/fs.image.render.md) draws it with `<image href="sandbox/posters/cutouts/9a1d….png" x=… y=… width=… height=…/>`.

Input:

```json
{
  "file": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "sandbox/posters/photos/3f9c….png",
    "filename": "3f9c….png",
    "mime": "image/png",
    "kind": "image",
    "size": 1822310,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.file.put",
    "trust": "untrusted"
  }
}
```

It answers:

```json
{
  "file": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "sandbox/posters/photos/3f9c….png",
    "filename": "3f9c….png",
    "mime": "image/png",
    "kind": "image",
    "size": 1822310,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.file.put",
    "trust": "untrusted"
  },
  "image": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "sandbox/posters/cutouts/9a1d….png",
    "filename": "9a1d….png",
    "mime": "image/png",
    "kind": "image",
    "size": 912400,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.image.chromakey",
    "trust": "sanitized",
    "width": 1024,
    "height": 1536,
    "format": "png",
    "source_deleted": false
  }
}
```
