12 releases

Uses new Rust 2021

0.6.2 Oct 20, 2022
0.6.1 May 1, 2022
0.6.0 Feb 5, 2022
0.5.3 Dec 18, 2021
0.2.0 Oct 23, 2020

#45 in Command-line interface

Download history 1465/week @ 2022-08-18 1307/week @ 2022-08-25 1613/week @ 2022-09-01 1565/week @ 2022-09-08 1364/week @ 2022-09-15 1208/week @ 2022-09-22 1579/week @ 2022-09-29 2120/week @ 2022-10-06 1592/week @ 2022-10-13 2364/week @ 2022-10-20 1863/week @ 2022-10-27 2042/week @ 2022-11-03 2102/week @ 2022-11-10 1658/week @ 2022-11-17 1607/week @ 2022-11-24 1249/week @ 2022-12-01

6,924 downloads per month
Used in 20 crates (18 directly)

MIT and LGPL-3.0-or-later

53KB
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

~13–19MB
~236K SLoC