18 releases

new 0.9.1 Oct 22, 2024
0.8.1 Oct 13, 2024
0.7.1 Oct 7, 2023
0.6.2 Oct 20, 2022
0.2.0 Oct 23, 2020

#35 in Command-line interface

Download history 4743/week @ 2024-07-05 4625/week @ 2024-07-12 6370/week @ 2024-07-19 4073/week @ 2024-07-26 5949/week @ 2024-08-02 4920/week @ 2024-08-09 4830/week @ 2024-08-16 3511/week @ 2024-08-23 3860/week @ 2024-08-30 4530/week @ 2024-09-06 5675/week @ 2024-09-13 6434/week @ 2024-09-20 6703/week @ 2024-09-27 7374/week @ 2024-10-04 4703/week @ 2024-10-11 6002/week @ 2024-10-18

26,366 downloads per month
Used in 40 crates (35 directly)

MIT and LGPL-3.0-or-later

56KB
1K SLoC

viuer

ci

Display images in the terminal with ease.

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.

Usage

With the default features, only image::DynamicImage can be printed:

use viuer::{print, Config};

let conf = Config {
    // Start from row 4 and column 20.
    x: 20,
    y: 4,
    ..Default::default()
};

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

And with the print-file feature, viuer can work with files, too:

use viuer::{print_from_file, Config};

let conf = Config {
    // Set dimensions.
    width: Some(80),
    height: Some(25),
    ..Default::default()
};

// Display `img.jpg` with dimensions 80×25 in terminal cells.
// The image resolution will be 80×50 because each cell contains two pixels.
print_from_file("img.jpg", &conf).expect("Image printing failed.");

Docs

Find all the configuration options in the full documentation.

Dependencies

~5–15MB
~198K SLoC