{"id":50260861,"url":"https://github.com/floatpane/termimage","last_synced_at":"2026-06-02T16:00:38.776Z","repository":{"id":360533543,"uuid":"1250548461","full_name":"floatpane/termimage","owner":"floatpane","description":"CGo library for displaying images in your terminal securely","archived":false,"fork":false,"pushed_at":"2026-05-31T18:01:57.000Z","size":152,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-06-01T15:27:59.841Z","etag":null,"topics":["cli","command-line","go","golang","golang-library","halfblock","image-decoding","image-processing","image-viewer","kitty-graphics","quantization","sandbox","security","sixel","sixel-graphics","stb-image","terminal","terminal-graphics","terminal-image","tui"],"latest_commit_sha":null,"homepage":"https://termimage.floatpane.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floatpane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"floatpane"}},"created_at":"2026-05-26T18:35:49.000Z","updated_at":"2026-05-31T18:02:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/floatpane/termimage","commit_stats":null,"previous_names":["floatpane/termimage"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/floatpane/termimage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatpane%2Ftermimage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatpane%2Ftermimage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatpane%2Ftermimage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatpane%2Ftermimage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatpane","download_url":"https://codeload.github.com/floatpane/termimage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatpane%2Ftermimage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33829346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","go","golang","golang-library","halfblock","image-decoding","image-processing","image-viewer","kitty-graphics","quantization","sandbox","security","sixel","sixel-graphics","stb-image","terminal","terminal-graphics","terminal-image","tui"],"created_at":"2026-05-27T10:00:40.752Z","updated_at":"2026-06-02T16:00:38.664Z","avatar_url":"https://github.com/floatpane.png","language":"C++","funding_links":["https://github.com/sponsors/floatpane"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# termimage\n\n**Render images in the terminal — Kitty, Sixel, or Unicode half-blocks — with a sandboxed decoder.**\n\n[![Go Version](https://img.shields.io/github/go-mod/go-version/floatpane/termimage)](https://golang.org)\n[![Go Reference](https://pkg.go.dev/badge/github.com/floatpane/termimage.svg)](https://pkg.go.dev/github.com/floatpane/termimage)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/floatpane/termimage)](https://github.com/floatpane/termimage/releases)\n[![CI](https://github.com/floatpane/termimage/actions/workflows/ci.yml/badge.svg)](https://github.com/floatpane/termimage/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n\u003c/div\u003e\n\n`termimage` is a small Go library that displays images in a terminal. It auto-detects the best supported protocol (Kitty graphics, DEC Sixel, or Unicode half-blocks as fallback) and decodes images in a sandboxed subprocess (Landlock + seccomp on Linux) so untrusted bytes never touch the parent process.\n\n## Features\n\n- **Auto-detected protocols** — Kitty, Sixel, half-block fallback. Works on any modern terminal.\n- **Multiple sources** — local files, `data:` URIs (base64), and `http(s)://` URLs.\n- **Sandboxed decoder** — image bytes parsed in an isolated subprocess with Landlock + seccomp on Linux.\n- **No CGO required for the consumer** — pure-Go API surface; the C decoder is contained in the worker subprocess.\n- **Terminal pixel detection** — sizes output to the actual cell pixel dimensions when available.\n\n## Install\n\n```bash\ngo get github.com/floatpane/termimage\n```\n\nRequires Go 1.26+.\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"os\"\n\n    \"github.com/floatpane/termimage\"\n)\n\nfunc main() {\n    // Required: must be the first call in main() so sandbox workers can\n    // re-exec into the decoder without running the rest of your program.\n    termimage.MaybeRunWorker()\n\n    err := termimage.Display(os.Stdout, \"cat.png\", termimage.Options{\n        Protocol:  termimage.Auto,\n        Sandboxed: true,\n    })\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n### Sources\n\nThe `src` argument accepts any of:\n\n```go\ntermimage.Display(os.Stdout, \"/path/to/cat.png\", opts)\ntermimage.Display(os.Stdout, \"https://example.com/cat.png\", opts)\ntermimage.Display(os.Stdout, \"data:image/png;base64,iVBORw0KGgo...\", opts)\n```\n\nRemote URLs and data URIs are fetched/decoded in the parent process, then handed\nto the sandboxed worker over stdin — the worker still runs with Landlock denying\nall filesystem access. Remote payloads are capped at 64 MiB.\n\nUse `DisplayContext` to pass a `context.Context` for cancellation of HTTP fetches\nand decoding.\n\n### Options\n\n| Field | Description |\n|-------|-------------|\n| `MaxWidth`, `MaxHeight` | Pixel bounds. `0` = detect from terminal. |\n| `Protocol` | `Auto`, `Kitty`, `Sixel`, or `HalfBlock`. |\n| `Sandboxed` | Decode in a Landlock + seccomp subprocess. |\n\n### Protocol detection\n\n`detect.Best()` inspects `$TERM`, `$TERM_PROGRAM`, and `$KITTY_WINDOW_ID`. No ANSI queries are sent, so it works without a TTY.\n\n| Terminal | Protocol |\n|----------|----------|\n| kitty, Ghostty, WezTerm | Kitty graphics |\n| foot, mlterm, Contour, xterm-sixel | Sixel |\n| everything else | half-block |\n\n## Sandbox\n\nOn Linux, the worker subprocess applies:\n\n- **Landlock** — restricts filesystem access to the single image path.\n- **seccomp-bpf** — blocks syscalls outside a read/decode allowlist.\n\nOn other platforms, the worker runs without OS-level restrictions but is still process-isolated.\n\n## Documentation\n\nFull API reference: [pkg.go.dev/github.com/floatpane/termimage](https://pkg.go.dev/github.com/floatpane/termimage)\n\n## Contributing\n\nPRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Security\n\nReport vulnerabilities privately via [SECURITY.md](SECURITY.md).\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatpane%2Ftermimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatpane%2Ftermimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatpane%2Ftermimage/lists"}