A simple ASCII Art Generator written entirely in Python, designed to convert bitmap images into colorful ASCII representations directly in your terminal β no external libraries required.
This project takes a bitmap image as input, processes its raw pixel data, and transforms it into ASCII art while preserving brightness and color information. The entire pipeline is built using only Pythonβs standard library, making it lightweight, portable, and easy to run anywhere Python is available.
- Pure Python β uses only the Python standard library
- Bitmap image parsing* to extract pixel-level data
- Image downscaling using a box filter to reduce resolution
- Grayscale conversion for accurate luminosity mapping
- Colored ASCII output printed directly in the terminal
-
Parsing the bitmap image
The program reads the bitmap image and extracts RGB pixel data. -
Downscaling image using Box Filter
To reduce resolution, a box filter is applied over pixel regions, averaging values to preserve image structure. -
Converting image to grayscale
Each pixel is converted to grayscale to accurately estimate luminosity. -
ASCII Mapping
Pixel brightness values are mapped to ASCII characters based on intensity. -
Terminal Rendering
The ASCII art is printed to the terminal using color codes to retain the original imageβs feel.
- Ensure you have Python 3.10 installed
- No external libraries or dependencies needed
- Clone the repository:
gh repo clone pvsssss/ascii-art-generator cd ascii-art-generator - Run the program:
python main.py
- Select a bitmap image when prompted The program will handle the rest automatically.
If the output image appears too large, adjust the scaling factor:
- Open
main.py - Locate the
SCALEvariable and increase it's value
βββ README.md
βββ samples/
β βββ sample1 in ascii.jpeg
β βββ sample1.bmp
β βββ sample2 in ascii.jpeg
β βββ sample2.bmp
β βββ sample3 in ascii.jpeg
β βββ sample3.bmp
βββ src/
βββ ascii.py
βββ image_processor.py
βββ main.py
βββ parser.py
βββ __pycache__/
βββ ascii.cpython-311.pyc
βββ ascii.cpython-313.pyc
βββ image_processor.cpython-311.pyc
βββ image_processor.cpython-313.pyc
βββ main.cpython-313.pyc
βββ parser.cpython-311.pyc
βββ parser.cpython-313.pyc
- Works only with bitmap images
- Terminal must support truecolor for colored output
This project was inspired and guided by learning resources from:
- Xander Gouws' video on making an ascii art generator in C
- Kay Lack's video on BMP images
- Wikipedia article on ansi escape codes t
Feel free to reach out or connect with me:
- LinkedIn: @PratakhveerSingh
- Instagram: @singh_pratakhveer


