···11+v1.0.0 (dev)
22+------------
33+44+- Initial public release (@avsm)
+18
LICENSE.md
···11+(*
22+ * ISC License
33+ *
44+ * Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>
55+ *
66+ * Permission to use, copy, modify, and distribute this software for any
77+ * purpose with or without fee is hereby granted, provided that the above
88+ * copyright notice and this permission notice appear in all copies.
99+ *
1010+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1111+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1212+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1313+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1414+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1515+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1616+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717+ *
1818+ *)
+66
README.md
···11+# kgp - Kitty Graphics Protocol for OCaml
22+33+An OCaml library for displaying images in terminals using the [Kitty Graphics Protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/).
44+55+This library can display PNG images in supported terminals (e.g. Kitty, WezTerm, Konsole, Ghostty) with varying levels of support depending on the terminal. Most core features work but some advanced things like animations might be only partially supported outside of Kitty.
66+77+Other features include:
88+- Image transmission with automatic chunking and base64 encoding
99+- Multiple placements of the same image
1010+- Animation support with frame deltas
1111+- Unicode placeholder mode for proper scrolling
1212+- tmux passthrough support (requires tmux 3.3+)
1313+- Terminal capability detection
1414+1515+The library provides a Cmdliner term via the `kgp.cli` package to make integration into other CLI tools easier.
1616+1717+## Installation
1818+1919+```
2020+opam install kgp
2121+```
2222+2323+## Usage
2424+2525+### Library
2626+2727+```ocaml
2828+(* Display a PNG image *)
2929+let png_data = read_file "image.png" in
3030+let cmd = Kgp.transmit_and_display ~format:`Png () in
3131+let buf = Buffer.create 1024 in
3232+Kgp.write buf cmd ~data:png_data;
3333+print_string (Buffer.contents buf)
3434+```
3535+3636+```ocaml
3737+(* Transmit once, display multiple times *)
3838+let cmd = Kgp.transmit ~image_id:1 ~format:`Png () in
3939+Kgp.write buf cmd ~data:png_data;
4040+4141+let cmd = Kgp.display ~image_id:1 () in
4242+Kgp.write buf cmd ~data:""
4343+```
4444+4545+### CLI
4646+4747+```
4848+# Display an image
4949+kgpcat image.png
5050+5151+# Display at specific size and position
5252+kgpcat --place 40x20@10,5 image.png
5353+5454+# Display from stdin
5555+curl -s https://example.com/image.png | kgpcat
5656+5757+# Detect terminal support
5858+kgpcat --detect-support
5959+6060+# Clear displayed images
6161+kgpcat --clear
6262+```
6363+6464+## License
6565+6666+ISC