5 releases (2 stable)

2.0.0 Jan 27, 2025
1.0.0 Jun 10, 2022
0.1.2 Dec 10, 2021
0.1.1 Dec 10, 2021
0.1.0 Dec 10, 2021

#598 in Command-line interface

Download history 3/week @ 2024-10-29 8/week @ 2024-11-05 5/week @ 2024-11-19 9/week @ 2024-11-26 7/week @ 2024-12-03 15/week @ 2024-12-10 2/week @ 2025-01-07 1/week @ 2025-01-14 53/week @ 2025-01-21 61/week @ 2025-01-28 18/week @ 2025-02-04 4/week @ 2025-02-11

136 downloads per month
Used in 2 crates

GPL-3.0-only

12KB
74 lines

ansipix

A Rust library for converting images to ANSI strings to print in a terminal

Usage

Get an ANSI string

let img = ansipix::of_image(&image::open("example.png").unwrap(), (50, 50), 100, false);
println!("{}", img);

Refer to the docs for more information.

Specify a different filter type

ansipix uses the image crate for reading and resizing the image. The of_image function uses FilterType::Nearest for resizing. You can specify a different one with the of_image_with_filter function.

use image::imageops::FilterType;

let img = ansipix::of_image_with_filter(&image::open("example.png").unwrap(), (32, 32), 255, false, FilterType::Triangle);
println!("{}", img);

Dependencies

~2.5MB
~53K SLoC