ASCII Generator is a C++ tool that converts images into expressive ASCII art using only stb_image.h. It reads images (like JPEG or PNG), calculates pixel brightness, and maps them to ASCII characters β creating stunning terminal-style visuals.
- πΌοΈ Load
.jpg,.png, and other formats viastb_image.h - π¨ Outputs ASCII representation directly in terminal or to a file
- π Adjustable resolution and scaling
- π‘ Customizable character sets
- π§ Lightweight and dependency-free (besides
stb_image.h)
ascii-generator/
βββ include/ # Header files (AsciiEngine.h, stb_image.h)
βββ src/ # Source files (AsciiEngine.cpp, main.cpp)
βββ bin/ # Compiled binary output
βββ Makefile # Easy build configurationMake sure you have a C++ compiler (e.g., g++ or clang++) installed.
git clone https://github.com/zmn17/ascii-generator.git
cd ascii-generator
makeAlternatively:
g++ -std=c++17 -Iinclude -o bin/ascii-art src/*.cpp./bin/ascii-art path/to/image.jpgOptionally, customize brightness mapping and resolution via the code or command-line (if implemented).
@##%%==--...
++==--::..
...
β¨ Want colorized ASCII in terminal? Check out
\033[1;Xmescape codes in C++.
stb_image.h(included in repo)
- Add grayscale image saving
- Add CLI support for resolution and output path
- Add more character set presets
- Export colored ASCII to HTML or SVG
Licensed under the MIT License.
Credit to nothings/stb for image loading.