ASCII art helpers

Today I would like to present some nice little ASCII tools that helped me a lot to write some of my posts or by beautifying my console programms.

Tree

Tree is a small programm that creates beautiful trees from your filesystem. On debian based systems you can install it with the following command.

apt-get install tree
Let's assume we have cloned for example the repository FastRoute with the following command.
git clone https://github.com/nikic/FastRoute.git
Cloning into 'FastRoute'...
remote: Counting objects: 385, done.
remote: Total 385 (delta 0), reused 0 (delta 0), pack-reused 385
Receiving objects: 100% (385/385), 83.40 KiB | 43.00 KiB/s, done.
Resolving deltas: 100% (204/204), done.
Checking connectivity... done.
Then we can create a nice ASCII tree with the following example command.
tree --charset=ascii -F --dirsfirst FastRoute/
FastRoute/
|-- src/
|   |-- DataGenerator/
|   |   |-- CharCountBased.php
|   |   |-- GroupCountBased.php
|   |   |-- GroupPosBased.php
|   |   |-- MarkBased.php
|   |   `-- RegexBasedAbstract.php
|   |-- Dispatcher/
|   |   |-- CharCountBased.php
|   |   |-- GroupCountBased.php
|   |   |-- GroupPosBased.php
|   |   |-- MarkBased.php
|   |   `-- RegexBasedAbstract.php
|   |-- RouteParser/
|   |   `-- Std.php
|   |-- BadRouteException.php
|   |-- bootstrap.php
|   |-- DataGenerator.php
|   |-- Dispatcher.php
|   |-- functions.php
|   |-- RouteCollector.php
|   |-- RouteParser.php
|   `-- Route.php
|-- test/
|   |-- Dispatcher/
|   |   |-- CharCountBasedTest.php
|   |   |-- DispatcherTest.php
|   |   |-- GroupCountBasedTest.php
|   |   |-- GroupPosBasedTest.php
|   |   `-- MarkBasedTest.php
|   |-- HackTypechecker/
|   |   |-- fixtures/
|   |   |   |-- all_options.php
|   |   |   |-- empty_options.php
|   |   |   `-- no_options.php
|   |   `-- HackTypecheckerTest.php
|   |-- RouteParser/
|   |   `-- StdTest.php
|   `-- bootstrap.php
|-- composer.json
|-- FastRoute.hhi
|-- LICENSE
|-- phpunit.xml
`-- README.md

9 directories, 35 files

Figlet

An other tool that I really like is FIGlet. On debian based systems you can install it with the following command.

apt-get install figlet
After that we can create nice headers for command line programms. For example with the following command.
figlet -fslant Gordon
   ______               __
  / ____/___  _________/ /___  ____
 / / __/ __ \/ ___/ __  / __ \/ __ \
/ /_/ / /_/ / /  / /_/ / /_/ / / / /
\____/\____/_/   \__,_/\____/_/ /_/
                                    

jp2a

A pretty cool tool to convert JPEG images into ASCII art is jp2a. You can install jp2a on Debian based systems with the following command.

apt-get install jp2a

We can use as example the Debian logo. I have just downloaded the SVG of the logo and exported it as PNG file with Inkscape. Unfortunately jp2a can only read JPEG files, but we can convert the PNG to an JPEG file.

convert debian.png debian.jpg

After that we can call jp2a on that image. Here an inverted example with fixed width.

jp2a --width=50 --invert debian.jpg
                     ':l,....
                 .:dO00000000Odc;;.
              .lk0000Ooc:;;:clx0000Oc.
            .d000Oc,.           .o0000o
           ,000l'                 .d000O.
          c00c                      l00::
         l00.          'c:;,'..      x0O.
        ,00,          l'             :00
        c0x          x.              ;00.
        c0c         .O               c0c
        c0;          O;        .    ;Od
        :0d         .'xc    .     .ck,
        .00          ..cdl,....,lxo'
         o0d'           .,;:cc;'.
          k00:
           x00.
            c0k.
             .d0o
               .l0d.
                  'lol.
                      .'..



                   .        ''
      NM:        .WM;      .kk.
   ...KM,   ...   NM, ..     .    ....     .  ..
.OWkodWM' oWdckMd XMx0OWMk .MM' kKxdkMN. ,MMxxxWMc
0Mc   XM'lMx   XM.XMk  .WM: MM.      kMo .MM'  dMO
MM'   NM.kMXkkkOO.XM;   0Ml WM. oX0doKMo  MM.  oMO
XMl   WM'oM0      XM;   NM. MM.:M0   0Mo  MM.  oMO
,WMxcxWM: OM0:,,: NMl.,OW;  MM''MWockKMo .MM.  dMO
 .0WX,OXd  ;0WMMX.ONMMNd   .KK: ,XW0.lXk 'KX.  dK0
Next Previous