Rust bindings for chafa, a terminal graphics library:
With chafa, you can now view very, very reasonable approximations of pictures and animations in the comfort of your favorite terminal emulator. The power of ANSI X3.64 compels you!
Using a convenience function: examples/image2ansi.rs
use chafa::image2ansi;
fn main() {
    let output = image2ansi("examples/test.png", (33, 16)).unwrap();
    println!("{}", output);
}| Before | After | 
|---|---|
![]()  | 
![]()  | 
Or using the normal chafa API: examples/demo.rs
use chafa::{Canvas, Config, PixelType, SymbolMap, Symbols};
fn main() {
    // see https://hpjansson.org/chafa/ref/chafa-using.html
 
    const PIX_WIDTH : i32 = 3;
    const PIX_HEIGHT : i32 = 3;
    const N_CHANNELS : i32 = 4;
    let pixels : [u8; (PIX_WIDTH * PIX_HEIGHT * N_CHANNELS) as usize] = [
        0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff,
        0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
        0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff
    ];
    let symbol_map = SymbolMap::new();
    symbol_map.add_by_tags(Symbols::ALL);
    let config = Config::new();
    config.set_geometry(23, 12);
    config.set_symbol_map(symbol_map);
    let canvas = Canvas::new(config);
    canvas.draw_all_pixels(PixelType::RGBA8_UNASSOCIATED,
                           &pixels,
                           PIX_WIDTH,
                           PIX_HEIGHT,
                           PIX_WIDTH * N_CHANNELS);
    let output : String = canvas.build_ansi();
    println!("{}", output);
}- 
Uses
rustc --version1.65.0 - 
Dependencies:
chafaandglibmust be installed. See the chafa installation page, the compilation page, and my notes atchafa-sys/build.rs::main. - 
git clone https://github.com/wong-justin/chafa-rust.git - 
cd chafa-rust && cargo build - 
Confirm that the example works by running
cargo test 
See the chafa C API.
Note: I'm new to both chafa and Rust's FFI binding process, so things may be a bit broken.
Looking for help: configuring builds + compilation, especially for Windows and Mac

