This is a command-line tool written in Rust that converts images into ASCII art. It uses the clap
, image
, and rusttype
libraries to process images and render ASCII characters based on the brightness of the corresponding image pixels.
- Usage
- Dependencies
- Installation
- Examples
- License
To use this tool, you can run it from the command line with the following options:
ascii_image --image <image_path> --font <font_path> [--width <output_width>]
- --image or -i: Path to the input image.
- --font or -f: Path to the font file (TTF format) for rendering ASCII characters.
- --width or -w: (Optional) Output image width (in pixels). If not specified, the aspect ratio of the input image is preserved.
This tool relies on the following Rust crates:
clap
: A command-line argument parser.image
: A crate for image processing.rusttype
: A crate for rendering TrueType fonts.
You can find these dependencies in the Cargo.toml file.
To build and run the tool, make sure you have Rust installed on your system. Then follow these steps:
- Clone this repository:
git clone <https://github.com/your-username/ascii-art-converter.git>
cd ascii-art-converter
- Build the project:
cargo build --release
- Run the tool:
cargo run --release -- --image <image_path> --font <font_path> [--width <output_width>]
Convert an image to ASCII art using the default font size and preserving the aspect ratio of the input image.
ascii_image --image example.png --font fonts/IBMPlexMono-Regular.ttf
Convert an image to ASCII art with a specific output width (e.g., 40 characters wide).
ascii_image --image example.png --font fonts/IBMPlexMono-Regular.ttf --width 40
This project is licensed under the GPLv3 License - see the LICENSE file for details.