Image2ASCII

A Python Learning Project, that recreates an image with text, commonly known as ASCII art. .

View the Project on GitHub

Image2ASCII - “Mountains” Test

Photography of Mountains by Jack B.

Photo by Jack B on Unsplash

To generate the ASCII Art from that image, run the following command:

python main.py tests/mountains/mountains.jpg 8

Using the default charset, the output should look like this:

%%%%%**%%%%%%###########################%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%******
%%%%%###############%%%%%%%%##@@@@@@@##########################%%%%%%%%%%%%%%%%%
%############%%%%********%%%%%#@@@@@@@@@@@@@@@@@@@@@@@###################%%%%%%%
#####@@@@@##%***********%%%%%%##@@@@@@@@@@@@@@@@@####@@@@@@@##@#########%%%%%%%%
##@@@@@@@#%%%%*******%%***%%%%%%##################@@@@@@####################%%%%
@@@@@@@@@@###%%%%%%%%%%%%%%%%%%%%%%%%####@@@@@@@@@@##%###@#@@@@@@@@@##########%%
########@##%%%%%%%%%%%%%%%%%%%%%%%%##@@@@@@@@@@@###@@@@@@@@@@@@@@@@@@###########
%%%%#####%%%%%%%%%%%%%%%%%%%%%##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@####
%%%###%%%%%%%%%%%%%%%%%%%%##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@####
###%%%%%%%%%%%%%%%%%###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
##%%%%%%%%%####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
:=-=#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
:::::%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+-..::%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
=+::-=-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=+%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
=+=-==::*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-:::--=%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@##
-==--+=::=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#-:::--::-*@@@@@@@@@@@@@@@@@@@@@@@#######
:-:::--::::*%*===++%@@@@@@@@@@@@@@@@@*=:::::-::::-@@@@@@@@@@@@@@@@@########%%%%%
.::....:.::::..-=---+%#%%*%@@@@@@@@%=-::-::--.::::==--+###########%%%%%%%%%%****
::::..::--::::.:::----:-::-*%%%%#%=:-::--::::.::::::-::*###%%%%%%%%%************
::::::..-::.:::::::----:--=+%%*%*=::::--:::::::::::::.:-*%%%%%*+==++-=+*++++++++
:::::::.::::.:-:::--::-:--++***+::::-:-=-:.:::::::::.:::=++++=-::::::--=========
=::.::.:.::::.--:::::---:-==-=-:::::-::==:::::::..::::::-=++--:::::::--=========
:-::...:::.....--:::-==-------:.:::.::-==-:::.::::::-.:::---::::::::::--++======
:=--:::.::::...::::::-+=----:---::..::-==-:::....::--:..::::::::::::::--=+======
:==--:::...:...:::--:::=----=---=:.:::-=--::...::::--..:::::-:::::::::---+======
--=-=:::..::...:::::::::::--=---=-:.:::-=--:....::--:.:::::::::::::::::==+++====
=====+-:...:.._.::::-=:::::-=++====::::-=-:::....::::::::::::-..:..:-::=++++++++
======+=::......::.-==-:::::-=++===-:::-----:::-:::::::::-::-:::-.::--==++++++++
=--=++++-::.....:::-==+-:::-:-====---::---:-::.::--::::.:::--:::=:.:--=+++++++++
---=+++*-::::.....::::==::::::-=-===---======-::.:--.:-::-:-::.:=-:---=+++++++++
---=++**+-:::::.....:::--:::--=+=++======-::::..::::...:.:.:....-=.::---+++++++=
-====+**+-:--------=---===========----::....................:::.::...:..-+++====
-=+--+++==-===+++++==========---------:::::.....................-:_.....:=++++++
===+=+++=-===++++=--===-------==+==------:::::::::::::::::::....::.__...-=++++++
======++========--=--------=+***+====--------::::::::::::-::::::::.....:=+++++++
============----===-::--=+*%%%*+++=======--------------------::::::.::::=+******
=========--=====------+*%##%**+++++++=======-----------======---:::::::-=++****+
+======--======-----=*%###%***+++++++++=======================-----:::--=+*****+
+=--:--===-==------=*%%###%%****+++++++++================+++====-------==+++***+
=-:::--=----------=+*%%%%%%*****+++++++++===============+++++====------==+++++++
-:.:--------:-=----=*%%%%%****++++++++++++=============++++++======--====+++++++
:.::--------:-==-:-+%%%%%%**++++++++++++++============++++++++===========+++++++
:.::-------:::==-:-=*%%%%%***+++++++++++++============++++++++===========+++++++
--:..--:----:-==-:--=*%%%%*****+++++++++++============++++++++===========+++++++
::::---------:-==-:--=*********+++++++==================+++++=============++++++
:.:---::--------=--::-=***%%***+++++=======================================+++==
-:::----:-------=---:--=*%%%%**+++++========================================++==

If you are using a light theme, use the reversed charset:

.....::......___________________________..................................::::::
....._______________........__       __________________________.................
.____________....::::::::....._                       ___________________.......
_____     __.:::::::::::......__                 ____       __ _________........
__       _....:::::::..:::......__________________      ____________________....
          ___........................____          __.___ _         __________..
________ __........................__           ___                  ___________
...._____.....................__                                            ____
...___....................__                                                ____
___.................___                                                         
__.........____                                                                 
____                                                                            
                                                                                
                                                                                
                                                                                
                                                                                
*=+=_                                                                           
*****.                                                                          
-+%%**.                                                                         
=-**+=+_                                  =-.                                   
=-=+==**:                                +***++=.                             __
+==++-=**=                             _+***++**+:                       _______
*+***++****:.:===--.                 :=*****+****+                 ________.....
%**%%%%*%****%%+=+++-._..:.        .=+**+**++%****==++-___________..........::::
****%%**++****%***++++*+**+:...._.=*+**++****%******+**:___.........::::::::::::
******%%+**%*******++++*++=-..:.:=****++*************%*+:.....:-==--+=-:--------
*******%****%*+***++**+*++--:::-****+*+=+*%*********%***=----=+******++=========
=**%**%*%****%++*****+++*+==+=+*****+**==*******%%******+=--++*******++=========
*+**%%%***%%%%%++***+==+++++++*%***%**+==+***%******+%***+++**********++--======
*=++***%****%%%******+-=++++*+++**%%**+==+***%%%%**++*%%**************++=-======
*==++***%%%*%%%***++***=++++=+++=*%***+=++**%%%****++%%*****+*********+++-======
++=+=***%%**%%%***********++=+++=+*%***+=++*%%%%**++*%*****************==---====
=====-+*%%%*%%#%****+=*****+=--====****+=+***%%%%************+%%*%%*+**=--------
======-=**%%%%%%**%+==+*****+=--===+***+++++***+*********+**+***+%**++==--------
=++=----+**%%%%%***+==-+***+*+====+++**+++*+**%**++****%***++***=*%*++=---------
+++=---:+****%%%%%****==******+=+===+++======+**%*++%*+**+*+**%*=+*+++=---------
+++=--::-+*****%%%%%***++***++=-=--======+****%%****%%%*%*%*%%%%+=%**+++-------=
+====-::-+*++++++++=+++===========++++**%%%%%%%%%%%%%%%%%%%%***%**%%%*%%+---====
+=-++---==+===-----==========+++++++++*****%%%%%%%%%%%%%%%%%%%%%+*#%%%%%*=------
===-=---=+===----=++===+++++++==-==++++++*******************%%%%**%##%%%+=------
======--========++=++++++++=-:::-====++++++++************+********%%%%%*=-------
============++++===+**++=-:...:---=======++++++++++++++++++++******%****=-::::::
=========++=====++++++-:.__.::-------=======+++++++++++======+++*******+=--::::-
-======++======+++++=:.___.:::---------=======================+++++***++=-:::::-
-=++*++===+==++++++=:..___..::::---------================---====+++++++==---:::-
=+***++=++++++++++=-:......:::::---------===============-----====++++++==-------
+*%*++++++++*+=++++=:.....::::------------=============------======++====-------
*%**++++++++*+==+*+-......::--------------============--------===========-------
*%**+++++++***==+*+=:.....:::-------------============--------===========-------
++*%%++*++++*+==+*++=:....:::::-----------============--------===========-------
****+++++++++*+==+*++=:::::::::-------==================-----=============------
*%*+++**++++++++=++**+=:::..:::-----=======================================---==
+***++++*+++++++=+++*++=:....::-----========================================--==

The output file of the first mountains.out.txt on Github.