Terminal image viewer CLI
The chafa-independent terminal image viewer: point candy-image at a PNG/GIF/JPEG and it detects your terminal, picks the best protocol — sixel, kitty, iTerm2, half/quarter blocks, an ANSI character ramp, or the chafa symbol engine — and writes the rendered bytes to stdout. All capability stays in sugar-image; this app is composition only.
composer require sugarcraft/candy-image
candy-image photo.png # auto-detect + render
candy-image --format=half --size=80x24 logo.png
candy-image --dump-detect # why is my image blank?
candy-image --animate clip.gif # sugar-animation playback
candy-image file.png — protocol auto-detection (kitty → iterm2 → sixel → chafa-free text floors) behind a single flag surface.--size=WxH / --width / --height / --scale=fit|shrink|fill|stretch|none|crop, mapped straight onto sugar-image's Scale enum.--format=chafa is refused by design — this viewer exists precisely to retire the chafa dependency from the image path.--format=chafa, --passthrough=tmux / screen) exit 1 naming what is missing — no silent ignore; --polite is a documented no-op.SugarCraft\CandyImage\Cli — the bin is a two-line shim, and a closure seam lets tests drive the wired Player without a terminal.| Class | Method | Description |
|---|---|---|
| Cli | main(argv, stdout, stderr, play) | Parse args, detect, render or animate; returns the exit code |
| Cli | viewportCells() | TTY-sized cell box (cols, rows-1) behind a stream_isatty gate, 60×24 fallback |
| Lang | t(key, params) | Localized CLI messages (namespace image) |