https://github.com/rubixdev/ansipix
A rust library for reading images as ANSI strings to print in a terminal
https://github.com/rubixdev/ansipix
rust rust-library
Last synced: 2 months ago
JSON representation
A rust library for reading images as ANSI strings to print in a terminal
- Host: GitHub
- URL: https://github.com/rubixdev/ansipix
- Owner: RubixDev
- Created: 2021-12-09T20:59:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-06T18:30:24.000Z (about 3 years ago)
- Last Synced: 2024-09-16T08:52:01.038Z (over 1 year ago)
- Topics: rust, rust-library
- Language: Rust
- Homepage: https://crates.io/crates/ansipix
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# ansipix
A Rust library for converting images to ANSI strings to print in a terminal
## Usage
### Get an ANSI string
```rust
let img = ansipix::of_image(&image::open("example.png").unwrap(), (50, 50), 100, false);
println!("{}", img);
```
Refer to the [docs](https://docs.rs/ansipix/latest/ansipix/) for more
information.
### Specify a different filter type
`ansipix` uses the [`image`](https://docs.rs/image/latest/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.
```rust
use image::imageops::FilterType;
let img = ansipix::of_image_with_filter(&image::open("example.png").unwrap(), (32, 32), 255, false, FilterType::Triangle);
println!("{}", img);
```