Trick of the day: rendering graphics in your terminal

“Those who cannot remember the past are condemned to repeat it”

— Jorge Agustín Nicolás Ruiz de Santayana y Borrás

limecat

Over the past few years, a number of “graphic terminal” emulator software have emerged. Some examples:

This is nothing new, in fact it was possible back in the 70’s, and you can try it using XTerm, the default terminal emulator bundled with X installations since forever!

The process is very simple, you simply have to run:

$ xterm -t -tn tek4014

Which will start an xterm emulating a TEK4014 terminal (instead of the default VTxxx plain-text terminal).

Tektronix_4014

TEK4010 terminal

Now we’ll download some images we want to display. These 40 year old terminals don’t support JPEG though (it didn’t exist back then), nor any popular modern image format, so we’ll have to provide images in a format they understand. Plotutils includes a couple of these vectorial images, so we will run:

# apt-get install plotutils

And finally it’s simply a matter of feeding the Tek4014 terminal with an image, for example:

$ zcat /usr/share/doc/plotutils/tek2plot/dmerc.tek.gz

The terminal will  be fed with an appropriate escape character sequence, along with the actual image contents, it’ll interpret it as an image (just like other escape sequences are interpreted as colored or underlined text), and the awesome result will be this:

 

xterm

How cool is that? 🙂

 

You can even resize the terminal window, and the graphics will be re-rendered with the correct size (remember it’s a vectorial image, so wen can zoom in indefinitely).

 

Tags: [en] | May 17th, 2013 |

2 Responses to “Trick of the day: rendering graphics in your terminal”

  1. illwieckz Says:

    So cool!

    But After displaying my first image I wanted to clear the screen to display another…

    In found in some docs like this http://edmond.orignac.pagesperso-orange.fr/tek4014.html or this
    http://www.columbia.edu/~kermit/ftp/a/msvibm.tek that the “clear screen” sequence is ESC FF.

    So if someone searches for the solution :

    printf ‘3314’

    Enjoy!

  2. illwieckz Says:

    hum, wordpress ate my comment…

    I must escape the escape sequence;

    printf '\033\014'

Leave a Reply