A Python command-line tool that converts images into ASCII art. It resizes the image, maps pixel brightness to ASCII characters, and outputs the result to a .txt file.
- Grayscale-to-ASCII character mapping
- Adjustable scaling factor (
-s) - Custom ASCII character sets (
-c) - Outputs art to a
.txtfile - Supports common formats:
.jpg,.jpeg,.png,.webp, etc.
- Python 3.10 or newer
- Pillow (Python Imaging Library)
Install with:
pip install pillowOr, if using Python 3 explicitly:
pip3 install pillow- Clone the repository
git clone https://github.com/LU-FFY/IMAGE-TO-ASCII.git
cd IMAGE-TO-ASCII- Install dependencies
pip install pillow- Run the script
python ascii_converter.py mona_lisa.jpg -s 3 -o mona_output.txtThis will create a text file
mona_output.txtcontaining the ASCII art.
| Flag | Description |
|---|---|
-s or --scale |
Adjust the downscaling factor (default: 1) |
-c or --charset |
Custom ASCII characters ordered from dark to light |
-o or --output |
Output file name (default: output.txt) |
python ascii_converter.py mona_lisa.jpg -s 2 -c "@#%=+-. " -o ascii_mona.txt- Higher scale values = more zoomed out = smaller output
- Shorter charsets = less contrast
- Darker characters (like
@or#) should appear first in the charset
Pull requests are welcome!
Feel free to fork the repo, make changes, and submit improvements via PR.
MIT License β do what you want, but give credit where it's due.