Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshuavandaele/ascii_image
A small Rust utility to transform images into ascii art
https://github.com/joshuavandaele/ascii_image
ascii ascii-art bmp clap-rs image-rs jpeg jpg png rust rusttype
Last synced: about 14 hours ago
JSON representation
A small Rust utility to transform images into ascii art
- Host: GitHub
- URL: https://github.com/joshuavandaele/ascii_image
- Owner: JoshuaVandaele
- License: gpl-3.0
- Created: 2023-08-20T21:24:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-12T17:22:01.000Z (about 1 month ago)
- Last Synced: 2024-11-12T18:25:17.859Z (about 1 month ago)
- Topics: ascii, ascii-art, bmp, clap-rs, image-rs, jpeg, jpg, png, rust, rusttype
- Language: Rust
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ASCII Art Image Converter
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.
## Table of Contents
- Usage
- Dependencies
- Installation
- Examples
- License## Usage
To use this tool, you can run it from the command line with the following options:
```sh
ascii_image --image --font [--width ]
```## Options
- --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.## Dependencies
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.
## Installation
To build and run the tool, make sure you have Rust installed on your system. Then follow these steps:
1. Clone this repository:
```sh
git clone
cd ascii-art-converter
```2. Build the project:
```sh
cargo build --release
```3. Run the tool:
```sh
cargo run --release -- --image --font [--width ]
```## Examples
### Example 1: Convert an Image
Convert an image to ASCII art using the default font size and preserving the aspect ratio of the input image.
```sh
ascii_image --image example.png --font fonts/IBMPlexMono-Regular.ttf
```### Example 2: Specify Output Width
Convert an image to ASCII art with a specific output width (e.g., 40 characters wide).
```sh
ascii_image --image example.png --font fonts/IBMPlexMono-Regular.ttf --width 40
```## License
This project is licensed under the GPLv3 License - see the [LICENSE](LICENSE) file for details.