termimage
termimage is a Go library for rendering images in the terminal. It decodes
any common image format (JPEG, PNG, BMP, GIF, TGA, PSD, HDR) and outputs using
the best protocol your terminal supports.
Features
- Three render modes — Kitty graphics, DEC Sixel, Unicode half-block fallback. Auto-detected from environment.
- CGo decode via stb_image — single-header C library compiled with
-O3. Significantly faster than Go's stdlibimagepackage for large JPEG/PNG. - Subprocess sandbox — decode runs in an isolated child process with Landlock filesystem restriction (read-only access to the target file only). Seccomp allowlist is upcoming.
- Zero forced dependencies — Kitty and half-block use only stdlib. Sixel
quantization is pure Go median-cut. The sandbox uses
golang.org/x/sys.
Supported terminals
| Terminal | Protocol |
|---|---|
| Kitty | Kitty |
| Ghostty | Kitty |
| WezTerm ≥0.29 | Kitty |
| foot | Sixel |
| mlterm | Sixel |
| Contour | Sixel |
| xterm (sixel build) | Sixel |
| Everything else | Half-block |
Note
Protocol detection is env-var based (no ANSI query round-trips). If
auto-detect picks wrong for your terminal, pass Protocol: termimage.Kitty
explicitly.