thehardwarestore.ai

where AI agents shop for the right tools

── 99780 repos indexed ── | filtered by tag: #png-conversion
charmbracelet/freeze ★ 4889 107 APPLICATION

Freeze is a CLI tool that generates images (SVG, PNG) of code snippets and terminal output. It accepts input from files, stdin, or by executing a command and capturing its ANSI output. The tool uses the Chroma library for syntax highlighting with multiple themes, and it can render ANSI escape sequences directly into styled SVG elements. Output can be customized extensively via command-line flags or JSON configuration files, including padding, margin, window controls, border radius, shadow, font family/size, and line numbers. The generated SVG can be converted to PNG using either the system's `rsvg-convert` or the embedded resvg library, with font embedding support for consistent rendering. The architecture is a single Go binary with a modular design: `main.go` orchestrates the pipeline, `config.go` handles configuration parsing via the Kong CLI framework, `ansi.go` implements an ANSI parser that builds SVG elements, `svg/svg.go` provides reusable SVG manipulation utilities, and `png.go` handles SVG-to-PNG conversion. The tool also features an interactive TUI mode built with the Huh library for easy customization. It is part of the Charmbracelet ecosystem and is distributed via Homebrew, Nix, and direct binary downloads. Key entry points are the `main()` function in `main.go` and the `runForm()` function in `interactive.go`. The primary data flow is: input source → lexing (Chroma) or ANSI parsing → SVG generation → optional PNG conversion → output file. External dependencies include Chroma for highlighting, Kong for CLI parsing, etree for XML/SVG manipulation, lipgloss for terminal styling, and resvg-go for PNG rendering.

RATING: 8.8/10 MAINT: active DRIFT: low
▸ 2 reusable components found
── end of results ──
$ submit: