Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

screenshot

gumcli screenshot <project.gumj> <element> [--output <path>] [--width <px>] [--height <px>] [--backend <name>] [--background <hex>]

Renders a Gum Screen or Component to a PNG file. The element is laid out and drawn using the same backend a shipped game would use, so the output is pixel-accurate and suitable for visual regression testing, documentation screenshots, or asset pipelines.

Arguments

  • <project.gumj> — Path to the .gumj or .gumx project file.

  • <element> — Name of the Screen or Component to render (for example, MainMenu or Controls/Button).

Options

  • --output — Path for the output PNG file. Defaults to <element>.png in the current directory.

  • --width — Width of the output image in pixels. Defaults to the project canvas width.

  • --height — Height of the output image in pixels. Defaults to the project canvas height.

  • --backend — Rendering backend to use: monogame (default, DesktopGL), raylib, or skia (SkiaGum, for games that draw with Skia).

  • --background — Background color to clear to before rendering, as 6-digit (RRGGBB) or 8-digit (RRGGBBAA) hex, with or without a leading #. Defaults to fully transparent.

Examples

gumcli screenshot MyProject/MyProject.gumj MainMenu
gumcli screenshot MyProject/MyProject.gumj Controls/Button --output button.png
gumcli screenshot MyProject/MyProject.gumj MainMenu --width 1920 --height 1080
gumcli screenshot MyProject/MyProject.gumj MainMenu --backend raylib
gumcli screenshot MyProject/MyProject.gumj MainMenu --background 1E2A38

Output on success:

Notes

  • Works cross-platform — the default monogame backend uses DesktopGL, not a Windows-specific rendering path.

  • Any fonts referenced by the element must already exist in the project's FontCache/ folder. Run gumcli fonts first if fonts are missing.

  • Bitmap content (sprites, nine-slices, text) is rasterized into the PNG at the requested resolution.

  • To compare the two backends' output for every element in a project at once, see diff-screenshots.

  • Rendering against the default transparent background can make some visual differences (a semi-transparent panel or border, for example) hard to see once the image is opened in isolation. Use --background to composite against an opaque color, ideally the same clear color your game actually uses, for a more representative comparison.

Exit Codes

Code
Meaning

0

Screenshot written successfully

1

Rendering failed (for example, the named element does not exist)

2

Project file not found, --backend is not monogame, raylib, or skia, or --background is not a valid hex color

Last updated

Was this helpful?