An Image to ASCII converter capable of turning images (.bmp, .png, .jpg, etc.) into ASCII characters. Can convert in 1:1, 2:1 and 1:2 modes.
When we convert an image to ASCII 1:1, the output looks a bit vertically stretched because in most fonts the characters are 2 times longer in hight comparing to width. And in 1:1 mode, every pixel from the image is mapped to a single ASCII character, while in 2:1, every 2 pixels (taken vertically) are mapped to a single character, making the output look natural, 1:2, on the other hand, stretches the output horizontaally, repeating every character twice.
./ascii-convert [INPUT FILE] [COLOR MODE] [GRADIENT LENGTH] [MODE] [OUTPUT FILE] [FONT] [FONT SIZE]COLOR MODE - either l(light) or d(dark)
GRADIENT LENGTH - by default, the gradient is 10 characters long: " .:-=+*#%@" you can reduce it,if you want!
MODE - 1 - 1:1, 2 - 2:1, 3 - 1:2
OUTPUT FILE - not specifying will result in output to console
If you wish to generate the output as an image, add one of the following to the end of the FILE_OUT: (.bmp, .png, .tga, .jpg)
This also requires a FONT file provided, you can look up supported font files in the SFML documentation
#*=. :=:.-+***##*-.:++-:=###################*- :*###############*==***+--+*=:--
*+-. ...-*######+:.--:-+*###################+. :*#################*==***+--+*+-:
*=:-: -*######*- ..:=*####################*- :+###################*==+**+-=+*+-
+:.-. .=#######+. :+**###########*********+-.=*####################*-:-+**=--+*
-:-: .-*######+: ::.:----::::.:........... ::-=+*#########**==*###*+--=**=:-*
-==..=****+==-. ....:--. .:-==+=--:--=*######*=:-+*=-=
::. .--:::--:.-++=---=-. .:::........ .::-=+*###########*=-==-:
:::-====+*##*+==:. .:-+**#%%%###**#***==:. .-+******+=--=*###*+-:.
***######*=-. -*%%%%%%%%%%###########*+-. .......:-+*######*+-
#####*+-:. -*%%%%%%%%%*=+############*=:. .-=**############
####=: :+#%%%%%%%+-=###############*=. :-+*############
###+: ... .. :=*#%%#+.:+#%%%%%%%%%%######+. .:--=+++++####
%%##=: :+*+: . .... .:---==:. -#%%%%%%%%%%%%%%###=. -=====-=+*###*
%%%%#*=:.-*##+. .::. .-----:. .=%%%%%%%%%%%%%%%%%#- :*###########*=
%%%%%%#*++*#%#=. .::.::. .:-------: .=#%%%%%%%%%%%%%%%%%#=: :+###########*=.
%%%%%%%##%%%%%*: ..::--:. .:-------:..-#%%%%%%%%%%%%%%%%%%+:.:+############=.
%%%%%%%##%%%%%*- .:------::---------:.-*%%%%%%%%%%%%%%%%%%%#-:=*############+:.:
%%%%%%%%##%%%%%=..-----------------:.=#%%%%%%%%%%%%%%%%%%#=:+#############+:.:-
%%%%%%%%%##%%%%*:.:---------------::=#%%%%%%%%%%%%%%%%%%%#**#############*-..-=
%%%%%%%%%%%#%%%#+:::------------::-+%%%%%%%%%%%%%%%%%%%%%%################+:.-==
%%%%%%%%%%%%%%%##+=---:::::::::.:=#%%%%%%%#%%%%%%%%%%%%%%################*:.-===
%%%%%%%%%%%%%%%%%%%%%####**+==-:-=+****++++#%%%%%%%%%%%%%%%%############*-.:====
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###**++++*##%%%%%%%%%%%%%%%%%%%%##########=. :====
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#######+: .-====
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%####*- .-=====
SFML 3.0.0 is used to open image files and get pixel colors.
I built it on Linux using CMake 3.31.6. You can do the same by simply running:
cmake .
makein the project folder. This will download SFML 3.0.0 from the official repository.
However, if you build on Windows, you may face some problems with SFML dependencies.