# wtrenderlib
Dependency-free Rust primitives for rendering RGB/RGBA image frames in terminals.
The default build has no normal dependencies and accepts decoded frames through
`FrameView`. It includes:
- ANSI truecolor Unicode half-block and quadrant rendering
- Kitty graphics protocol rendering
- iTerm2 inline image protocol for caller-provided encoded images
- Optional Sixel encoding (`--features sixel`)
- tmux/screen DCS passthrough wrapping helpers
- Optional external `ffmpeg` raw-video frame source
- Optional `image` adapter (`png` and `jpeg` only)
The library deliberately does not expose a file decoder type in its core API.
Applications can choose their own decoder and pass borrowed pixel buffers
without converting them to a common image crate.
```rust
use wtrenderlib::render::{render_unicode, UnicodeOptions};
use wtrenderlib::{FrameView, PixelFormat, RenderOptions};
let pixels = [255, 0, 0, 0, 0, 255];
let frame = FrameView::new(&pixels, 2, 1, 6, PixelFormat::Rgb8)?;
let mut output = std::io::stdout();
render_unicode(
frame,
&mut output,
UnicodeOptions {
render_options: RenderOptions::new(2, 1)?,
hide_cursor: false,
},
)?;
# Ok::<(), wtrenderlib::Error>(())
```
Enable the optional image adapter with `--features image`. Video decoding is
kept outside the Rust dependency graph and can use `FfmpegSource` when the
`ffmpeg` executable is installed.
For iTerm2-compatible terminals, pass encoded PNG/JPEG bytes to
`render::render_iterm2`; the core intentionally does not add an image encoder
just to produce this protocol.
Sixel support is opt-in because it adds the `icy_sixel` dependency:
```text
cargo run --features sixel --example render_raw
```
When a graphics protocol is used inside tmux or screen, wrap the generated
sequence with `render::write_passthrough` and the appropriate
`render::Multiplexer` variant.
Compatibility notes and a reproducible local benchmark are in
[`docs/compatibility.md`](docs/compatibility.md).