Skip to content

Latest commit

 

History

History
124 lines (111 loc) · 8.2 KB

README.md

File metadata and controls

124 lines (111 loc) · 8.2 KB

asciimg

Simple image to ascii art conversion.

Shell integration

To plot images in the terminal using all available space, add an alias in your shell's configuration file:

eg. for zsh:

alias img='f() { ./asciimg "$1" -res ${COLUMNS}x$(echo ${LINES}-1|bc)};f'

Options

Switch Description
--res WIDTHxHEIGHT Sets the rows and columns to use for rendering
--threshold VALUE Thresholds the pixel values
--invert Inverts the pixel values

Samples

asciimg avatar.png 100x55

....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
...............................................,,,,,,...............................................
.......................................,,,,,,,,,,,,,,,,,,,,,,.......................................
...................................,,,:;;;iiiiiiiiii;;;;ii;:,,,,,...................................
.................................,::;;;;:,,,,.,;;;;;;;;;;;;i;;;::,,.................................
................................,:::,,....,,,,,,,::;:;;;;::::::;;;:,,...............................
..............................,,:,,,,.,:iii;;::,,,,:::;ii;;:::,,,::;::,,............................
.............................,,::::i%XX$$$$$$X%tttiitii;;;;;;::,....,:::,,..........................
............................,,::;%$@@@@@@@@@$$$XX%%%XXXXt;;;;;;;;;:;;;;::::,,.......................
...........................,,,,%$@@@@@@@@@@$$$$$$$$$$$$$$Xt;:;;;;;;;;;;;;;;:,,......................
..........................,,,,X@@@@@@@@@@@$$$$$$$$$$$$$XXX%t;::::,:;;::::::;;,,.....................
.........................,,,,%@@@@@@@@@@@@@@$$$$$$$XXXXX%%%ti:,,,,,,,,:::,::;;:,....................
........................,,::t$$@@@@@@@@@$$$$$$$XXXXXXX%%%%tti;,....,,,,:::::::;,,...................
........................,::iX$@@@@@@$$$XX%%%%XXXXXXXX%%%%%ti;;:..   ..,,,::,,:;;,...................
.......................,,:;%$$$$$$$$X%t;,.,,,;::;it%%%%%%%%ti:,,..    ..,:,,:::;:,..................
.......................,,:i%X%%XX$$X%i:,,.,,:;;;;;;;t%%%%%%tt;:,..      .,,,:::::,,.................
........................,:::,::iX$$Xt;,..........,::;it%%%%%ti:,...      ..,,,,:::,.................
........................,,:;;;it$@$Xt;:,.,:iii;::,:;;i%%%%%%%t;,....      ..,,,,,:,.................
........................,,;;,,%@@XXX%%i;;;;ii;;;it%%%XXXXXXX%t:,,,..      ...,,,,:,.................
........................,,::;X@$$XXXXXXXXXXXXXXXXXXXXXXXXXX%%i,....     ........,:,.................
.......................,,:;t$@$$XXX%XXXX$$$$$$@$$$$$$XXXXX%%t;,....   .,:;:,....,:,.................
.......................,,:iX$X%%%%%XX%%%X$$$$$$XX$$XXX%%%%%%t:. ....,;;:::;;:...,,..................
......................,,::%%%i;:,,:;iiiit%%%X%%%%%%%%%%%ttttt:...,,:;;;;;;;;;,..,...................
......................,,:tXXt:,,....,,;iitttt%%%%%%%%%%ttttii:,,,:;;;;;itti;;:..,...................
......................,:;XXX%t:,....,:ittttttt%%%%%%%%ttttii;:,,,;iii::;itii;..,,...................
.....................,,:;XXX%%;,,....,:;;iit%%%%%%%%%tttii;;::,,:iiiiiiiitii,..,....................
.....................,,:;%XXt:,,::,,...,...,it%%%%tttttii;;::,,:;iit%%t%tti,  ......................
.....................,,,;%%i,,:::;iii;;::,,,;iiitttttiii;;::,,::;;it%%%tti,  .......................
......................,,;ti,,:ittiiiiitt%%%i;ii;;;iii;;;:::,,,::;;:,,::,. ..........................
......................,,:t;::iti;::;it%%%%ttiii;;:;;;;;;::,,,,,::;:,.      .........................
......................,,:iiittti;;;;it%%tttii;;;::::::::,.....,,::;;:,     ,........................
......................,,,iiit%ti;;;;;;;;;::,,::::,,,,,....  ...,:;i;;,.   .:........................
.......................,,i;;;;;:,,,,................ .        .:;iii:,.  .::;,......................
.......................,,i::,,.....                          .,:;i;:,.. .,::::,.....................
........................,::,..                              .,:;;;::,...,..,,:,.....................
.........................,,,.                              .,::::::,..,.  .,,::.....................
...........................:,                            .,,::::::,.... ....,,,,....................
..........................,,,                          .,,,::::::,......,,,....,....................
.........................,:  ..                      .,,,,:::::,,.....,,,,......,,..................
.......................,:.   ,::.                 ..,,,:::::,.  .   .,,,...     .,,.................
.......................,,.  .,::.            ....,.,,,..           ..,,...      .,,.................
......................,:..,...,,.  ......                           ....       ..:,,,...............
.....................,;,.,,,,...                                              ..,::;:,..............
....................,::,,,:::..                                              .,:::::;;,,............
....................,:,..,:::,.                                              ..,,,,,:;,,,,..........
...................,,;;:,..,,,.                                             ......,,::;;:,,,,.......
....................,;;:,,.                                               ....  .,,,,::::;;:,,,.....
.....................,,:;:..                                             ... ..,,,,,,:::::::;::,,,..
.....................,,,,,:,                                                ..,,...,,::::::::::;;:,:
..............,,,,,,,,,,,,,,.                                             .........,:::::::;;;;;;:;;

asciimg avatar.png 50x27

..................................................
..................................................
..................................................
.......................,,,,.......................
..................,:;i;iii;;ii:,,.................
................,:,..,,,,::;;:::;:,...............
..............,,:;X$$$$%tttt;;;:,.,:,,............
.............,,;@@@@@$$$$$$$$%;;;;;;;;:...........
.............,:@@@@@@@$$$XXX%ti,.,,:::;:..........
............,:$$$$$Xt;itXX%%%t;,.  ,,::;,.........
............,ittXX%,...,:;i%%%t:..  .,,:;,........
............,;;;@X%;:;i;;:i%XX%;,.   ..,,,........
............,;%@XXXXX$$$$$$XXX%,..   ...,,........
...........,,t%iit%t%XXXXXX%%tt..,::::;.,.........
...........,:X%,..,ittt%%%%ttii,,i;:tii.,.........
...........,;X%,,,...,t%%%%ti;::;itttt............
...........,:t,:ttiitt;iiiii;:,:;;it;.............
...........,:iit;;t%%ti;::;::,,,:::   ............
............,;ii::,,,...,...   .;i;. ,:...........
............,:.                :;:,.,,:...........
...............              .:::,.. .,:..........
.............:..           .,:::,..,,.............
............, .:.       ..,,.     .,.    ,........
...........;.,,.                       .,;:.......
..........,,.::.                       ,:,:,,.....
..........,;,.                       .. .,:::;,,..
...........,,:                        ....,:::::;,

asciimg avatar.png 25x13

.........................
.........................
.........:i:i;i;,........
.......,:$@$%%i;:::......
......,t@@@$XX%i.,::,....
......,,Xt...;%%.  ,:....
......,$XX$$$$%t. ;.,....
......;%,,tt%%i;:;i:.....
......:,;i%i;;:,;. ......
......,,.       ;,.:.....
........      ,::.,......
.........           ,,...
.....:,            ..:;,.