wtrenderlib 0.1.0

Dependency-free terminal rendering primitives for RGB and RGBA frames
Documentation
  • Coverage
  • 2.17%
    2 out of 92 items documented0 out of 16 items with examples
  • Size
  • Source code size: 65.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wkqco33

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.

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:

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.