Function viuer::print_from_file

source ·
pub fn print_from_file<P: AsRef<Path>>(
    filename: P,
    config: &Config
) -> ViuResult<(u32, u32)>
Expand description

Helper method that reads a file, tries to decode it and prints it.

Example

use viuer::{Config, print_from_file};
let conf = Config {
    width: Some(30),
    transparent: true,
    ..Default::default()
};
// Image will be scaled down to width 30. Aspect ratio will be preserved.
// Also, the terminal's background color will be used instead of checkerboard pattern.
print_from_file("img.jpg", &conf).expect("Image printing failed.");