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 stdlib image package 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

TerminalProtocol
KittyKitty
GhosttyKitty
WezTerm ≥0.29Kitty
footSixel
mltermSixel
ContourSixel
xterm (sixel build)Sixel
Everything elseHalf-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.