14 releases

0.7.1 Oct 7, 2023
0.6.2 Oct 20, 2022
0.6.1 May 1, 2022
0.6.0 Feb 5, 2022
0.2.0 Oct 23, 2020

#35 in Command-line interface

Download history 3053/week @ 2023-08-14 4162/week @ 2023-08-21 2646/week @ 2023-08-28 4658/week @ 2023-09-04 4613/week @ 2023-09-11 3275/week @ 2023-09-18 3923/week @ 2023-09-25 4879/week @ 2023-10-02 3816/week @ 2023-10-09 4265/week @ 2023-10-16 3736/week @ 2023-10-23 4932/week @ 2023-10-30 5273/week @ 2023-11-06 5892/week @ 2023-11-13 3924/week @ 2023-11-20 3799/week @ 2023-11-27

19,299 downloads per month
Used in 32 crates (28 directly)

MIT and LGPL-3.0-or-later

54KB
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:

Usage

Add this to Cargo.toml:

[dependencies]
viuer = "0.6"

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

~7–20MB
~190K SLoC