Sixel
Encyclopedia
Sixel is a bitmap graphics format supported by terminals and printers from DEC
, most notably the VT320 and VT420
. It encodes bitmaps into a character-based format that is easy to interpret, allowing it to be printed on a dot matrix
printer with limited internal decoding.
character, offset by 63 so that an all-black sixel, 0 decimal, is encoded as "?". This ensures that the sixels remain within the easily printable range of the character set. Carriage return is represented by "$", and line feeds with a "-", although a line feed operated more like a newline
(one source suggests "/" was used instead of "$" in some implementations).
Sixel also included a rudimentary form of compression, using run length encoding (RLE). This was accomplished with the "!" character followed by a decimal number of the times to repeat, and then a single sixel character to be repeated. Since the ! and decimal digits could not be valid sixel data, lying outside the encoded range, the encoding was easy to identify and expand back out in software.
"Sixel mode" was entered by sending the sequence
(deprecated in favor of p3), p2 how to interpret the color of zeros, and p3 with simple grid size parameters.
For printing, sixels are sent to the printer, decoded back into binary, and sent directly to the six pins of the print head. The only complexity involved expanding the RLE's into the internal print buffer. Display on a terminal is somewhat more difficult. On terminals supporting graphics (generally those with a name like "VTx4x") the ReGIS
graphics system was used to directly draw the sixels into the screen's bitmap. On other terminals, the majority of DEC's lineup, they defined a custom character set with every possible sixel.
Color was also supported using the "#" character, followed by a number referring to one of a number of "color registers", which varied from device to device. Colors were defined using either RGB or HSV values in a peculiar DEC format. On a printer a line of sixels was sent several times, each representing a single bitplane from the register-based colors on the terminals (normally 2 or 4 bits). For non-graphics terminals, color was simply dropped. Since the capabilities of the hardware varied widely, a color sixel drawing could only be output to targeted devices.
The example above enters sixel mode, sets up three color registers, and then uses those registers to draw sixels in those colors. The
The data lines following select a color, yellow for the first and third and green for the middle, then draw sixels. The last line shows the RLE in use. These sixels form the shape "HI".
Digital Equipment Corporation
Digital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...
, most notably the VT320 and VT420
VT420
The VT420 was a computer terminal designed by Digital Equipment Corporation . Introduced in 1990, it fit up to 50 lines on the screen and supported two sessions, either one through each communication port, or by multiplexing two sessions on one line with a suitable terminal server...
. It encodes bitmaps into a character-based format that is easy to interpret, allowing it to be printed on a dot matrix
Dot matrix
A dot matrix is a 2-dimensional array of LED used to represent characters, symbols and images.Typically the dot matrix is used in older computer printers and many digital display devices. In printers, the dots are usually the darkened areas of the paper...
printer with limited internal decoding.
Description
Sixel encodes images by breaking up the bitmap into a series of 6-pixel high horizontal strips. Each 1-pixel-wide vertical column in a particular strip forms a single "sixel". Each sixel's pixels are read as binary and encoded into a single 6-bit number, with "on" pixels encoded as a "1". This number, from 0 to 63 decimal, is then converted into a single ASCIIASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
character, offset by 63 so that an all-black sixel, 0 decimal, is encoded as "?". This ensures that the sixels remain within the easily printable range of the character set. Carriage return is represented by "$", and line feeds with a "-", although a line feed operated more like a newline
Newline
In computing, a newline, also known as a line break or end-of-line marker, is a special character or sequence of characters signifying the end of a line of text. The name comes from the fact that the next character after the newline will appear on a new line—that is, on the next line below the...
(one source suggests "/" was used instead of "$" in some implementations).
Sixel also included a rudimentary form of compression, using run length encoding (RLE). This was accomplished with the "!" character followed by a decimal number of the times to repeat, and then a single sixel character to be repeated. Since the ! and decimal digits could not be valid sixel data, lying outside the encoded range, the encoding was easy to identify and expand back out in software.
"Sixel mode" was entered by sending the sequence
Pp1;p2;p3;q
. The p1 through p3 were optional setup parameters, with p1 defining an aspect ratioAspect ratio
The aspect ratio of a shape is the ratio of its longer dimension to its shorter dimension. It may be applied to two characteristic dimensions of a three-dimensional shape, such as the ratio of the longest and shortest axis, or for symmetrical objects that are described by just two measurements,...
(deprecated in favor of p3), p2 how to interpret the color of zeros, and p3 with simple grid size parameters.
P
is the standard DEC "Device Control String", or DCS, which was used to turn on or off a number of special features in DEC's equipment. The "q" is the sixel identifier. Sixel data then followed the q. The "Stop Text" sequence \
returned the device back to normal character mode again.For printing, sixels are sent to the printer, decoded back into binary, and sent directly to the six pins of the print head. The only complexity involved expanding the RLE's into the internal print buffer. Display on a terminal is somewhat more difficult. On terminals supporting graphics (generally those with a name like "VTx4x") the ReGIS
ReGIS
ReGIS, short for "Remote Graphic Instruction Set", was a vector graphics markup language developed by Digital Equipment Corporation for later models of their famous VT series of computer terminals. ReGIS supported rudimentary vector graphics consisting of lines, circular arcs, and text...
graphics system was used to directly draw the sixels into the screen's bitmap. On other terminals, the majority of DEC's lineup, they defined a custom character set with every possible sixel.
Color was also supported using the "#" character, followed by a number referring to one of a number of "color registers", which varied from device to device. Colors were defined using either RGB or HSV values in a peculiar DEC format. On a printer a line of sixels was sent several times, each representing a single bitplane from the register-based colors on the terminals (normally 2 or 4 bits). For non-graphics terminals, color was simply dropped. Since the capabilities of the hardware varied widely, a color sixel drawing could only be output to targeted devices.
Sample
Pq
#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0
#1~~@@vv@@~~@@~~$
#2??}}GG}}??}}??-
#1!14@
\
The example above enters sixel mode, sets up three color registers, and then uses those registers to draw sixels in those colors. The
#0;2;0;0;0
is interpreted as "set color register 0, use RGB mode (2), set R, G and B to 0". This sets color 0 to black, and the following commands set register 1 to yellow and 2 to green.The data lines following select a color, yellow for the first and third and green for the middle, then draw sixels. The last line shows the RLE in use. These sixels form the shape "HI".