# fs.image.render

Draw an SVG as a picture, no browser

# fs.image.render

```
fs.image.render [--from FILE] [--text TEXT] [--width N] [--height N] [--fit cover|contain|fill] [--format png|jpg|webp|pdf] [--quality N] [--delete-source] [--store TEXT] [--folder TEXT] [--filename TEXT] [--path TEXT] [--on-conflict error|skip|overwrite] → image
```

Draw an SVG as a picture, no browser. The SVG is exactly one of `--from` — a stored .svg: a FileRef, an upload or a store key — or `--text`, the markup itself. Pictures inside it come from the project only — `<image href>` is a store path or `repo://static/…`, never a URL or a data URI. Text is shaped with the bundled Inter or a family the project has under `static/fonts/` (named by family; an unknown one is refused with the list); `<text inline-size="900">` wraps its lines and `data-fit="shrink"` beside it shrinks the size until the text fits `data-max-lines` (default 1). Effects are SVG filters. With no `--width`/`--height` the canvas is the SVG's own size; one side scales the other; both use `--fit cover|contain|fill`. Writes `--format png|jpg|webp|pdf` (default png, `--quality` for jpg; pdf keeps text as text and takes no size flags) under `--folder` (default `images/`) and adds `image` — a durable FileRef with `width`, `height`, `format`, `source_deleted` and `layout` (every text and picture box, the overlaps, what leaves the canvas, `ok`) — keeping the rest of the payload; `--delete-source` removes the `--from` file once the picture is written. Look at it with `--preview image`.

## Flags

- `--from`: A stored .svg: a FileRef, an upload or a store key. Set --from or --text.
- `--text`: The SVG markup itself, usually {{ input.… }}. Set --from or --text.
- `--width`: Canvas width in pixels (default: the SVG's own; alone, height follows in proportion).
- `--height`: Canvas height in pixels (default: the SVG's own; alone, width follows in proportion).
- `--fit`: cover (default), contain or fill — how the SVG reaches --width × --height.
- `--format`: png (default), jpg, webp or pdf (text stays selectable; no --width/--height/--fit).
- `--quality`: JPEG quality 1–100 (default: 82).
- `--delete-source`: Delete the --from file once the picture 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: images).
- `--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 poster the model wrote, kept as a PNG

```
| fs.image.render --text "{{ input.text.data.svg }}" --folder sandbox/posters/out --preview image
```

`ai.text.generate --schema '{"type":"object","required":["svg"],"properties":{"svg":{"type":"string"}}}'` before it answers the SVG as `text.data.svg`. `inline-size` wraps the headline; pictures are `<image href="sandbox/posters/photos/venue.jpg">`.

Input:

```json
{
  "text": {
    "data": {
      "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1080\" height=\"1350\"><rect width=\"1080\" height=\"1350\" fill=\"#012169\"/><text x=\"540\" y=\"640\" font-family=\"Inter\" font-weight=\"800\" font-size=\"120\" fill=\"#fff\" text-anchor=\"middle\" inline-size=\"918\">RESEARCH SHOWCASE NIGHT</text></svg>"
    }
  }
}
```

It answers:

```json
{
  "text": {
    "data": {
      "svg": "<svg …>"
    }
  },
  "image": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "sandbox/posters/out/9f2c….png",
    "filename": "9f2c….png",
    "mime": "image/png",
    "kind": "image",
    "size": 412300,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.image.render",
    "trust": "generated",
    "width": 1080,
    "height": 1350,
    "format": "png",
    "source_deleted": false
  }
}
```

### A certificate as a PDF, the name shrunk to its line

```
| fs.image.render --text "{{ input.svg }}" --format pdf --folder certificates --filename cert-2026-0412
```

A [`fs.file.get`](/nodes/fs/fs.file.get.md) of the template .svg and a `script` that fills the placeholders come before it. The name is real text in the PDF; a long one shrinks instead of wrapping. `--width/--height/--fit` are refused with pdf.

Input:

```json
{
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1123\" height=\"794\">…<text x=\"561\" y=\"420\" font-family=\"Inter\" font-size=\"64\" text-anchor=\"middle\" inline-size=\"900\" data-fit=\"shrink\" data-min-size=\"28\">Alexandra Josephine Montgomery Whitfield</text>…</svg>"
}
```

### A stored SVG at a size

```
| fs.image.render --from "{{ input.file }}" --width 512 --height 512 --fit contain --format webp --folder logos
```

After `fs.file.put --from "{{ input.webhook.files.logo }}" --accept image`. `contain` keeps the proportions, so a wide logo answers 512×n.

Input:

```json
{
  "file": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "uploads/logo.svg",
    "filename": "logo.svg",
    "mime": "image/svg+xml",
    "kind": "image",
    "size": 2210,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.file.put",
    "trust": "untrusted"
  }
}
```
