| Crates.io | ascii_image |
| lib.rs | ascii_image |
| version | 0.1.1 |
| created_at | 2025-11-19 15:43:12.31067+00 |
| updated_at | 2025-11-19 15:46:21.052097+00 |
| description | Render images as colorized ASCII art. |
| homepage | |
| repository | https://github.com/HardBoss07/ascii-image |
| max_upload_size | |
| id | 1940292 |
| size | 20,074 |
A Rust library to render images as ASCII art with optional ANSI color output. Supports resizing and smooth character ramps for better aesthetics.
image and paletteAdd to your Cargo.toml:
[dependencies]
cargo add ascii_image
Or clone the repo:
git clone https://github.com/yourusername/ascii-image.git
cd ascii-image
cargo build --release
use ascii_image::{render_path_to_ascii, Options};
fn main() -> anyhow::Result<()> {
let opts = Options {
max_width: 100,
max_height: 50,
colored: false,
};
let ascii = render_path_to_ascii("example.png", &opts)?;
println!("{}", ascii);
Ok(())
}
You can also use it without writing Rust code, using the included CLI example:
use ascii_image::{render_path_to_ascii, Options};
use std::env;
fn main() -> anyhow::Result<()> {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
eprintln!("usage: cargo run --example cli -- <image>");
anyhow::bail!("no image provided");
}
let opts = Options {
max_width: 120,
max_height: 60,
colored: true, // set to false for plain ASCII
};
let output = render_path_to_ascii(&args[1], &opts)?;
print!("{output}");
Ok(())
}
Run the example:
cargo run --example cli -- path/to/image.png
MIT License © 2025 Matteo Bosshard