Displaying Sixel Image Files

Sixel is a bitmap graphics format supported by some terminals and printers from Digital Equipment Corporation (now part of Hewlett-Packard Company) [1]. A typical data stream looks like [1,2]:


Apart from the ESCape in the introductory and termination sequences, it is legible text, with usually a lot of question marks. Many details are given in [2,3]; here we consider the situation that you have a Sixel file, you wish to view the image it contains, but you do not have the right DEC equipment (admittedly a situation that does not occur often!). On a DEC computer, you can just $ TYPE the file. So you could perhaps try a MicroVAX II with a QVSS display under SIMH and install VMS with DECWindows.

There seems to be no tool that can convert the Sixel format to e.g., Portable Network Graphics (PNG). The Portable Pixmap Format can be converted to Sixel using "ppmtosixel", but there is no tool for the opposite direction.

The DEC users library has a package "sixel_print", which converts a Sixel file to PCL, which can be printed, or converted to PDF using "pcl2pdf" of GhostPDL. But in the first step there is no color support (and VMS is needed, unless the parser is ported).

If you have an Amiga, you could perhaps use the program in AmigaBASIC at [2]. One day I decided to convert that code to Javascript, and let the browser display the graphics in an HTML 5 canvas [7]. That is how I learned that the above Sixel code displays as in the image below. Using the browser one can save the image as PNG.

Sixel image

Sixel is ASCII; could it also be ASCII art?
That turns out to be not so easy; the following is the best I have:








Which displays as follows:

Sixel image

In the Sixel Image Viewer [7] some example files (including many of those collected by Ross Combs [5]) can be viewed. The current palette can be viewed and reset. Some images do not define all colors, so that their presentation depends on the current palette.
There is a text field where Sixel art can be entered, and viewed using the a "Show" button. The Sixel string of simple images is also shown in this text field, so that variations can be tried easily. A version that creates basic Postscript files was also written [8], which may be converted to PNG using ImageMagick. Interestingly, the Sixel files are often smaller than the created PNG files.

On [4], there are some notes on how to display a Sixel file using XTerm, which seems to be possible since 2013! The Sixel graphics may scroll or not depending on an XTerm menu option. Download the latest source from [6]; configure building XTerm with "--enable-sixel-graphics"; and start one with for example "xterm -ti 340", to specify a Sixel-capable VT. I typed "cat monkey.six", which did not work, but "cat wikiimage.six" (from [5]) did! The introductory and termination sequences in "monkey.six", and other files created with ppmtosixel, are different from the description in [2]. These are valid (see [3]), but XTerm does not recognize them when utf-8 is set. With the additional command line option '+u8', the file is displayed correctly.

Here lies an interesting future for Sixel graphics (for any operating system with XTerm). A first idea is to have Sixel art as the prompt. For example, in bash, try "export PS1=`cat wikiimage.six`". Or create a file "prompt.six", which contains for example (without the double quotes):

"\ePq#1NNNN#2NNNN#3NNNN\$oooo#1oooo#2oooo-#3BBBB#1BBBB#2BBBB\${{{{#3{{{{#1{{{{????\e\\ "

Another idea is to insert bitmaps from a scanned character set (in this case from a PDP-11 programming card) and convert DCL output to an image. An example is shown below (the Sixel file size is about 21 blocks).

Sixel image

Furthermore, a Sixel terminal driver is now available in Gnuplot. An advantage of Sixel output in XTerm is that the output is in the same window as Gnuplot's command line, and one can scroll back to previous figures. The following image was created using Gnuplot's terminal driver test.

Sixel image

The author just finished a command line edition of the ZX81 emulator [9]. This brings its BASIC to Unix or VMS and vice versa. Output to the printer is converted to ASCII and redirected to the console. Output to the TV screen is not displayed directly, but may be redirected to the console via the "copy" command", or in Sixel graphics using the "scopy" command. Below is the output of a Sixel version of a famous (1K) chess game.

Sixel image

As an exercise to learn the Julia programming language [10], a module was written to create simple Sixel graphics. Below is the output of two of the demos. See also [11] for reading, displaying, and converting a Sixel Graphics file with Julia.

Sixel image

Sixel image

After the above was written, many more terminal emulators capable of displaying Sixel graphics, and a comprehensive library [12] have become available!


1. Information about Sixels on Wikipedia
2. All about Sixels: ftp://ftp.cs.utk.edu/pub/shuford/terminal/all_about_sixels.txt
3. VT330/VT340 Programmer Reference Manual: http://www.vt100.net/docs/vt3xx-gp/chapter14.html
4. Sixel support in XTerm: http://lists.debian.org/debian-x/2013/07/msg00133.html
5. Collected Sixel files: ftp://invisible-island.net/temp/SIXEL.tgz
6. XTerm: ftp://invisible-island.net/xterm/
7. Sixel Image Viewer in Javascript: http://rullf2.xs4all.nl/sg/sg.html
8. Sixel to Postscript converter: http://rullf2.xs4all.nl/sg/sixeltops.zip
9. A ZX81 emulator producing Sixel Image Files: http://rullf2.xs4all.nl/sg/zx81ce.html
10. The Julia programming language: http://julialang.org
11. Reading, displaying, and converting a Sixel Graphics file with Julia: https://gist.github.com/olofsen/9057600
12. A lightweight, fast implementation of DEC SIXEL graphics codec: https://github.com/saitoha/libsixel