| Crates.io | pixel2char |
| lib.rs | pixel2char |
| version | 0.1.0 |
| created_at | 2025-07-24 05:24:07.25307+00 |
| updated_at | 2025-07-24 05:24:07.25307+00 |
| description | A tool to convert images to ASCII art, available as a library, WASM module, and CLI. |
| homepage | |
| repository | https://github.com/AndPuQing/pixel2char |
| max_upload_size | |
| id | 1765536 |
| size | 66,576 |
This directory contains the core Rust logic for the image-to-ASCII-art conversion, which is compiled into both a WebAssembly (WASM) module for the web interface and a standalone command-line interface (CLI) tool.
To use the command-line tool, you must have Rust and Cargo installed.
Build the optimized release version of the CLI:
cargo build --release --features=cli
The executable will be located at target/release/pixel2char-cli.
Execute the CLI with the path to your input image.
./target/release/pixel2char-cli -i /path/to/your/image.jpg
| Flag | Argument | Description | Default |
|---|---|---|---|
-i, --input |
<PATH> |
Path to the input image file. | (Required) |
-d, --downsample-rate |
<RATE> |
Downsample rate for the image. Higher values mean smaller output. | 8 |
-e, --edge-sobel-threshold |
<THRESHOLD> |
Sobel edge detection threshold. | 50 |
--ascii-chars-edge |
<CHARS> |
ASCII characters for edges, from dark to light. | `" -/ |
--ascii-chars-gray |
<CHARS> |
ASCII characters for grayscale, from dark to light. | "@?OPoc:. " |
The project includes a benchmark suite using criterion to measure the performance of the core image processing functions.
To run the benchmarks:
cargo bench
The results, including an HTML report, will be saved in the target/criterion directory.