> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/cli/cli/svg.md).

# svg

```
gumcli svg <project.gumx> <element> [--output <path>] [--width <px>] [--height <px>]
```

Renders a Gum Screen or Component to a vector SVG file. Useful when you need scalable output for documentation, print, or design tooling rather than a fixed-resolution bitmap.

## Arguments

* `<project.gumx>` — Path to the `.gumx` project file.
* `<element>` — Name of the Screen or Component to render.

## Options

* `--output` — Path for the output SVG file. Defaults to `<element>.svg` in the current directory.
* `--width` — Width of the output SVG in pixels. Defaults to the project canvas width.
* `--height` — Height of the output SVG in pixels. Defaults to the project canvas height.

## Examples

```
gumcli svg MyProject/MyProject.gumx MainMenu
gumcli svg MyProject/MyProject.gumx Controls/Button --output button.svg
gumcli svg MyProject/MyProject.gumx MainMenu --width 1920 --height 1080
```

Output on success:

```
SVG written to: /full/path/to/MainMenu.svg
```

## Notes

* Uses SkiaGum's `SKSvgCanvas` to produce the SVG, so shapes and text are emitted as vector elements.
* Bitmap content (sprites, textures) is embedded as base64-encoded images inside the SVG. The file is self-contained but can be significantly larger than the equivalent PNG when the element contains many bitmaps.
* If you need a rasterized PNG instead, use [`gumcli screenshot`](/gum/cli/cli/screenshot.md).

## Exit Codes

| Code | Meaning                                                       |
| ---- | ------------------------------------------------------------- |
| 0    | SVG written successfully                                      |
| 1    | Export failed (for example, the named element does not exist) |
| 2    | Project file not found                                        |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flatredball.com/gum/cli/cli/svg.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
