7 releases (4 breaking)

new 0.5.1 Jun 21, 2021
0.5.0 Jun 21, 2021
0.4.0 Mar 16, 2021
0.3.1 Dec 25, 2020
0.1.0 Sep 27, 2020

#39 in Command-line interface

Download history 122/week @ 2021-02-26 150/week @ 2021-03-05 141/week @ 2021-03-12 161/week @ 2021-03-19 157/week @ 2021-03-26 620/week @ 2021-04-02 1234/week @ 2021-04-09 1146/week @ 2021-04-16 1897/week @ 2021-04-23 1868/week @ 2021-04-30 2560/week @ 2021-05-07 2329/week @ 2021-05-14 1502/week @ 2021-05-21 802/week @ 2021-05-28 1309/week @ 2021-06-04 798/week @ 2021-06-11

5,651 downloads per month
Used in 8 crates (7 directly)

MIT and LGPL-3.0-or-later

52KB
1K SLoC

viuer

Display images in the terminal with ease.

ci

viuer is a Rust library that makes it easy to show images in the terminal. It has a straightforward interface and is configured through a single struct. The default printing method is through lower half blocks (▄ or \u2585). However some custom graphics protocols are supported. They result in full resolution images being displayed in specific environments:

For a demo of the library's usage and example screenshots, see viu.

Examples

// src/main.rs
use viuer::{print_from_file, Config};

fn main() {
    let conf = Config {
        // set offset
        x: 20,
        y: 4,
        // set dimensions
        width: Some(80),
        height: Some(25),
        ..Default::default()
    };

    // starting from row 4 and column 20,
    // display `img.jpg` with dimensions 80x25 (in terminal cells)
    // note that the actual resolution in the terminal will be 80x50
    print_from_file("img.jpg", &conf).expect("Image printing failed.");
}

Or if you have a DynamicImage, you can use it directly:

// ..Config setup

let img = image::DynamicImage::ImageRgba8(image::RgbaImage::new(20, 10));
viuer::print(&img, &conf).expect("Image printing failed.");

Docs

Check the full documentation for examples and all the configuration options.

Dependencies

~5–7MB
~91K SLoC