[](https://crates.io/crates/cursive-image)
[](https://docs.rs/cursive-image)
Cursive Image
=============
An image view for the [Cursive](https://github.com/gyscos/cursive) TUI library.
Works on terminals that support the [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol.html), such as the following:
* [Ghostty](https://github.com/ghostty-org/ghostty)
* [iTerm2](https://github.com/gnachman/iterm2)
* [Kitty](https://github.com/kovidgoyal/kitty) (duh!)
* [Konsole](https://github.com/kde/konsole)
* [Warp](https://github.com/warpdotdev/Warp)
* [Wayst](https://github.com/91861/wayst)
* [WezTerm](https://github.com/wezterm/wezterm)
* [xterm.js](https://github.com/xtermjs/xterm.js)
You can provide image data directly as RGB (24 bits per pixel), RGBA (32 bits per pixel), or from the following source formats:
* PNG (natively supported by the graphics protocol)
* GIF via [gif](https://github.com/image-rs/image-gif) (enable `gif` feature)
* JPEG via [zune-jpeg](https://github.com/etemesi254/zune-image) (enable `jpeg` feature)
* SVG via [resvg](https://github.com/linebender/resvg) (enable `svg` feature)
* PDF via [hayro](https://github.com/LaurenzV/hayro) (enable `pdf` feature)
The view supports shrink, fit, and scale sizing modes (shrink is the default), image alignment, and scrolling.
Check out the [examples](https://codeberg.org/tliron/cursive-image/src/branch/main/examples).
> In the future we may add support for additional graphics protocols, namely [iTerm](https://iterm2.com/documentation-images.html) and [Sixel](https://github.com/saitoha/libsixel).
License
-------
Like much of the Rust ecosystem this project is licensed under your choice of either
* [Apache License, Version 2.0](https://codeberg.org/tliron/cursive-image/src/branch/main/LICENSE-APACHE)
* [MIT license](https://codeberg.org/tliron/cursive-image/src/branch/main/LICENSE-MIT)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
All code and documentation was written by humans. We do not accept "AI"-generated contributions.