ASCII-ART is a python script that converts images to ASCII art.
For example, when the following image of a dinosaur -
will be converted to an image such as (width of image can be adjusted)-
,::.
.@@&*++:@@:
,@&,,,,,,,,,*@
#8,,,,,,,,,,,,,@,
#:,,,,,,,,,,,,,,,@.
#*,,,,,,,,,,,,,,,,,@
oo+,,,,,,,,,,,,,,,,,,#
.@+,,,,,,,,,,,,,,,,,,,@+
@++,,,,,,+++:o::*,,,,,,@
+&++,,,,,++:o8@@@@&+,,,,8.
@*++,,,+++:o@@+ +@+,,,+8 +o&888&:+.
.8*+++++++*o@@ @+,,,@8:++,,,++:&@@#*
8**+++++++o&@ ., *,,+@,,,,,,,,,,,,,+8@#.
*#**++++++*o@& ,::,8+++8,,,,,,,,,,,,,,,,,##
.@***++++++oo@ ::::.+++*,,,+,,,,,,,,,,,,,,+@
@****++++++o8@ ::::::+++,++++,+,,,,,,,,,,,,+@
8:***+++++++o@& :&&o:::+++++++++++,,,,,,,,,,,,8,
@****+++++++o@: *:&&&&::*++++++++++++++,,,,,,,,:,#
@****++++++++o@* ::&&&&::*+++++++++++++++++,,,,&@:@
@****++++++++o#o :::&&o::*+++++++++++++++++++++#@o8
+:****++++++++oo@ ::::::::*+++++++++++++++++++++&@oo.
@::**+++++++++:o@ .::::::,+++++++++++++++++++++++@oo.
@::::+++++++++*o#+ +::. ,+++++++++++++++++++++++**&.
#::::**++++++++oo@ .* ++++++++++++++++++++++++++8
8:::******++++++oo@ :++++++++++++++++++++++++++@
&::::*******+*++*oo#. .o+++++++++++++++++++++++++++@
8::::**********+*+oooooo*++++++++++++++++++++++++++++&
8::::**************+***+++++++++++++++++++++++++++++&.
@:::::+,,,,,,,,,+****++***++++++++++++++++++++++++++@
,#:::8+,........,,.*&::::::****++++++++++++++++++++++8
@,::o+,............,,*@:::::::****++++++++++++++++++#.
@+*@++,...,..........,,##:::::::**:***++++++++++++++#
::+o++++,,,,,,,,,..,,....,@@@@@@#&@@******++++++++++@
@,+@++++,,,,,,,,,,,,,,,,,.,&@#: .#. @@#:*:::**+++**&:
@++@+++++,,,,,,,,,,,,,,,,,,,,.&@@8+.@# *@8,8:*****&8
@++8++++++,,,,,,,,,,,,,,,,,,,,,,,.*#@@88&. @&@@@@@+
.#++*:++++++,,,,,,,,,,,,,,,,,,,,,,,,,,,,*&@@@@@@@@@
+o+++@++++++++,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..,,8
o*+++&*+++++++++,,,,,,++++,,,,,,,,,,,,,,,,,,,,,,,+@
&+++++@++++++++++++++++++++++,,,,,,,,,,,,,,,,,,++*&
8++++++@:+++++++++++++++++++++++++++++,,,,,,++++*@
#+++++++&@+++++++++++++++++++++++++++++++++++++@&
8++++++++*#@o++++++++++++++++*o&&&8888#@@@@@@@:
&+++&+++++**:#@@@o:**:o@@@8o+....
o*+@+,,,++*o*,,,,,*::@.
o*&+,,,,,+*:&+,,,,,,,:8
:*@,,,,,,+*:@*,,,,,,,,@.
:88,,,,,+**:&o,,,,,,,,,@
o@+,,,,++*::&8+,,,,,,,,:#
8@+,,,++**::@:+,,,,,,,,,@,
8, @@+++++**:::@+++,,,,,,,,,@
@+#8 @*+++++**::@o++++,,,,,,,,:8
*&,+&@ +@+++++**::@8+++++,,,,,,,,,@
@.,++*@. .@o+++*:**:@#+++++++,,,,,,,,,#
@..++++@, @@+++++*@::@++++++++,,,,,,..,@
@...++++@@ #:@+++++*:@@:+++++++++,,,,,..,+&
#+,,++++++@# .@*:@+,++++*#@++++++++++,,,,....,@
::,,,+++++++@@* o@#8++@,,,++++:@:+++++++++,,,,....,#.
.@+,,++++++++,o@@@@#88##@@@#+++++*:@,,++++*o@**++++++++,,......,8 .
@+,,,++++++++++++++++++++++++**:++@+,++++*:#@@@@&+++++,.......,@#8@@
.#+,,,+++++++++++++++++++++++:++++*@+,+++**::::#,@@+++,.......,@,,,*:
@++,,,+++++++++++++++++++++#++++++@8,++++++***#, ::*+,,,...,,,@,,,8.
.@+,,,++++++++++++++++++++8++++++++@+,+++++***:@.88*+,,,,,,,,,@,,,@
#*+,,,,+++++++++++++++++oo++++++++@:,,++++****@##,@,,,,,,,,,,@#,@@
@++,,,,++++++++++++++++@*++++++++:@,,,++++***:@,++#+,,,,,,,,@@#o#o
.@++,,,,,+++++++++++++*&*+++++++++@+,,,+++***:@,+++#,,,,,,,,@*@@#@+
*#+++,,,.,+++++++++++8:*+++++++++@+,,,++++**:@:++++@,,,,,,,@*o#,,8o
&8+++,,,,,,+++++++++#:*+++++++++@,,,,++++**o@@+++++@,,,,,+8**@,,,#.
&8++++,,,,,,,+*++++#:**++++++++8#+,++****:@,.@++++oo,,,,@***:@,,o+
o@+++++,,,,,,,,,++#:**+++++++++@+++++**:&@ @,++++@,,,,@*+**@,8@
,@*+++++,,,,,,,,,*o:**++++++++*@*+++**&@..o@+++++o:,,@*+++*o8,
@&++++++,,,,,,,.#:::+++++++++:@@**:@@@@@&+,,,,,+@,o#*++++:&
*@o++++++++,,,,@::::*+++++++++&@@@+@++++,,,,,,+@+@+++++**#
+@@#+++++++++:o::::***+++++++*@ #++++,,,,,,+#@:*++++**#
8@*+++++++@:::::**+++++++++8@@+++++,,,,,+8*:::**:*:#
,@@:+++++#:::::*****++++++++++++++,,,++8:::::::::o
.&@@#:oo:::::******+++++++++++++++++@::::::::#
,o@:::::::*****+*+++**+++++++++@o:::::::@
::::::::::*****:*****++++++*#ooo::::@+
+o:::::::::::::::****+++++@ooooooo#@
8::::::::::::::::******&#oooooo#@
.&::::::::::::::::***o@ooooo
@:o::::::::::::::::#8oooo:*@*
@:::::::::::::::::@:******@.
@::**++++****++++@*******@
@::**++++++++++:@******o@
@:***+++++++++@#******88
@:***++++++++@&:*****&#
@o:*+++++*:*@:*****o88.
@++,,,,,,,,,++,*8#:++*****#8.
,@+,,,,,,,,,,,,,++++*&@:*****::8@.
@++,,,,,,,,,,,,++++**8*.@8***oo@++@&
@+++++++++++++++++:#:*8. .@8@o#+,,,,@*
.8++++++++++++++++**&@8#... +@&@8++,,,:@
#:*+++++++++++++++*#: .#8,, .@+,@o++,,,@.
@::***************:@,.. *@., .@+,#@++,,,@.
#::::::**********:::,... *@.. .@,,#@+,,,+@
.8:::::::::::::::::&+,,,, &#, .@,,#o+,,,+@
,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
$ git clone https://github.com/KhorSL/ASCII-ART.git
$ cd ASCII-ART
$ pip install -r requirements.txt
$ python ascii-art.py samples/images/dino.png
Artifacts generated will be in output/
.
Adjust FIXED_NEW_WDITH
and large_font
to fine tune the image.
''' other codes... '''
FIXED_NEW_WIDTH = 200
''' other codes... '''
def string_image(string, font_path=None):
''' other codes... '''
large_font = 20 # get better resolution with larger size
''' other codes... '''
- No future plans as of now.