Sixel

Last updated
The Wikipedia logo converted to the Sixel format and rendered in Konsole. Sixel new Wikipedia logo.png
The Wikipedia logo converted to the Sixel format and rendered in Konsole.

Sixel, short for "six pixels", is a bitmap graphics format supported by terminals and printers from DEC. It consists of a pattern six pixels high and one wide, resulting in 64 possible patterns. Each possible pattern is assigned an ASCII character, making the sixels easy to transmit on 7-bit serial links.

Contents

Sixel was first introduced as a way of sending bitmap graphics to DEC dot matrix printers like the LA50. After being put into "sixel mode" the following data was interpreted to directly control six of the pins in the nine-pin print head. A string of sixel characters encodes a single 6-pixel high row of the image.

The system was later re-used as a way to send bitmap data to the VT200 series and VT320 terminals when defining custom character sets. A series of sixels are used to transfer the bitmap for each character. This feature is known as soft character sets or dynamically redefinable character sets (DRCS). With the VT240, VT241, VT330, and VT340, the terminals could decode a complete sixel image to the screen, like those previously sent to printers.

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 ASCII character, offset by 63 so that an all-black sixel, 0 decimal, is encoded as ?. This ensures that the sixels remain within the printable character range of the ASCII character set. Carriage return (CR) is represented by $, and line feeds (LF) with a -; both had to be sent in turn to return the cursor to the start of the line, CRLF.

Sixel also includes a rudimentary form of compression, using run-length encoding (RLE). This is 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 cannot be valid sixel data, lying outside the encoded range, the encoding is easy to identify and expand back out in software.

"Sixel mode" is entered by sending the sequence ESC+Pp1;p2;p3;q. The p1 through p3 were optional setup parameters, with p1 defining an aspect ratio (deprecated in favor of p3), p2 how to interpret the color of zeros, and p3 with simple grid size parameters. ESC+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. [lower-alpha 1] Sixel data then followed the q. The "String Terminator" sequence ESC+\ 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 six pins in the print head. The only complexity involved expanding the RLEs into the internal print buffer. Display on a terminal is somewhat more difficult. On terminals supporting graphics, the ReGIS graphics system was used to directly draw the sixel pattern into the screen's bitmap. This was done at high speed by storing the bitmap patterns as a glyph and then blitting them.

When used for defining custom character sets the format was almost identical, although the escape codes changed. In terms of the data, the only major difference is the replacement of the separate CR/LF with a single /. In the VT300 series for instance, 80-column character glyphs were 15 pixels wide by 12 high, meaning that a character could be defined by sending a total of 30 sixels.

Color is also supported using the # character, followed by a number referring to one of a number of color registers, which varied from device to device. The colors in the registers are defined using either RGB or HLS values in a peculiar DEC format. To create a color image on a printer, a line of sixels is sent several times, each representing a single bitplane from the register-based colors on the terminals (normally 2 or 4 bits). Since the capabilities of the hardware vary widely, a color sixel drawing can only be output to targeted devices. Non-graphics terminals generally silently ignore sixel escape sequences.

Sample

The sample Sixel code that says "HI" displayed in a xterm with VT340 emulation. Sixel demo.png
The sample Sixel code that says "HI" displayed in a xterm with VT340 emulation.
 <ESC>Pq  #0;2;0;0;0#1;2;100;100;0#2;2;0;100;0  #1~~@@vv@@~~@@~~$  #2??}}GG}}??}}??-  #1!14@  <ESC>\ 

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 mode 2 (RGB mode), set R, G and B to 0%". This sets color 0 to black, and the following commands set register 1 to yellow (100%, 100%, 0%) and 2 to green (0%, 100%, 0%). Unlike most modern systems which assign an 8-bit value (0255) to each color channel, RGB mode is based on "intensity" of each channel from 0% to 100%.

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, meaning "repeat @ (0b100000) 14 times". The final output is 14 pixels by 7 pixels, so the last line simply repeats 0b100000 14 times to fill the last line. $ at the end of a line means that the next line will overprint the current line, while - means that the next line represents a new line of sixels.

Notes

  1. Lower-case "p" was the ReGIS identifier.

See also

Related Research Articles

<span class="mw-page-title-main">ASCII</span> American character encoding standard

ASCII, abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of technical limitations of computer systems at the time it was invented, ASCII has just 128 code points, of which only 95 are printable characters, which severely limited its scope. Modern computer systems have evolved to use Unicode, which has millions of code points, but the first 128 of these are the same as the ASCII set.

<span class="mw-page-title-main">Raster graphics</span> Matrix-based data structure

In computer graphics and digital photography, a raster graphic represents a two-dimensional picture as a rectangular matrix or grid of square pixels, viewable via a computer display, paper, or other display medium. A raster is technically characterized by the width and height of the image in pixels and by the number of bits per pixel. Raster images are stored in image files with varying dissemination, production, generation, and acquisition formats.

In computer science, an escape sequence is a combination of characters that has a meaning other than the literal characters contained therein; it is marked by one or more preceding characters.

<span class="mw-page-title-main">ANSI escape code</span> Method used for display options on video text terminals

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as commands, rather than text to display verbatim.

The BMP file format or bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device, especially on Microsoft Windows and OS/2 operating systems.

<span class="mw-page-title-main">VT220</span> Computer terminal from Digital Equipment Corporation

The VT220 is a computer terminal introduced by Digital Equipment Corporation (DEC) in November 1983. The VT240 added monochrome ReGIS vector graphics support to the base model, while the VT241 did the same in color. The 200 series replaced the successful VT100 series, providing more functionality in a much smaller unit with a much smaller and lighter keyboard. Like the VT100, the VT200 series implemented a large subset of ANSI X.364. Among its major upgrades was a number of international character sets, as well as the ability to define new character sets.

<span class="mw-page-title-main">Color Graphics Adapter</span> IBM PC graphic adapter and display standard

The Color Graphics Adapter (CGA), originally also called the Color/Graphics Adapter or IBM Color/Graphics Monitor Adapter, introduced in 1981, was IBM's first color graphics card for the IBM PC and established a de facto computer display standard.

<span class="mw-page-title-main">IBM Monochrome Display Adapter</span> IBM PC graphic adapter and display standard

The Monochrome Display Adapter is IBM's standard video display card and computer display standard for the IBM PC introduced in 1981. The MDA does not have any pixel-addressable graphics modes, only a single monochrome text mode which can display 80 columns by 25 lines of high-resolution text characters or symbols useful for drawing forms.

Text mode is a computer display mode in which content is internally represented on a computer screen in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a character set; at the same time, contrasted to graphics mode or other kinds of computer graphics modes.

<span class="mw-page-title-main">MOS Technology 8563</span>

The 8563 Video Display Controller (VDC) was an integrated circuit produced by MOS Technology. It was used in the Commodore 128 (C128) computer to generate an 80-column RGB video display, running alongside a VIC-II which supported Commodore 64-compatible graphics. The DCR models of the C128 used the later and more technically advanced 8568 [D]VDC controller.

<span class="mw-page-title-main">TMS9918</span> Video display controller

The TMS9918 is a video display controller (VDC) manufactured by Texas Instruments, in manuals referenced as "Video Display Processor" (VDP) and introduced in 1979. The TMS9918 and its variants were used in the ColecoVision, CreatiVision, Memotech MTX, MSX, NABU Personal Computer, SG-1000/SC-3000, Spectravideo SV-318, SV-328, Sord M5, Tatung Einstein, TI-99/4, Casio PV-2000, Coleco Adam, Hanimex Pencil II, and Tomy Tutor.

<span class="mw-page-title-main">Tektronix 4010</span> Text and graphics computer terminals

The Tektronix 4010 series was a family of text-and-graphics computer terminals based on storage-tube technology created by Tektronix. Several members of the family were introduced during the 1970s, the best known being the 11-inch 4010 and 19-inch 4014, along with the less popular 25-inch 4016. They were widely used in the computer-aided design market in the 1970s and early 1980s.

<span class="mw-page-title-main">Hold-And-Modify</span> Display mode used in Commodore Amiga computers

Hold-And-Modify, usually abbreviated as HAM, is a display mode of the Commodore Amiga computer. It uses a highly unusual technique to express the color of pixels, allowing many more colors to appear on screen than would otherwise be possible. HAM mode was commonly used to display digitized photographs or video frames, bitmap art and occasionally animation. At the time of the Amiga's launch in 1985, this near-photorealistic display was unprecedented for a home computer and it was widely used to demonstrate the Amiga's graphical capability. However, HAM has significant technical limitations which prevent it from being used as a general purpose display mode.

Netpbm is an open-source package of graphics programs and a programming library. It is used mainly in the Unix world, where one can find it included in all major open-source operating system distributions, but also works on Microsoft Windows, macOS, and other operating systems.

The Glyph Bitmap Distribution Format (BDF) by Adobe is a file format for storing bitmap fonts. The content takes the form of a text file intended to be human- and computer-readable. BDF is typically used in Unix X Window environments. It has largely been replaced by the PCF font format which is somewhat more efficient, and by scalable fonts such as OpenType and TrueType fonts.

<span class="mw-page-title-main">VT420</span> Computer terminal from Digital Equipment Corporation

The VT420 is an ANSI standard computer terminal introduced in 1990 by Digital Equipment Corporation (DEC). The 420 is the only model in the 400 series, replacing the VT320. There are no color or graphics-capable 400 series terminals; the VT340 remained in production for those requiring ReGIS and Sixel graphics and color support. The entire lineup of VT300s and VT420 was eventually replaced by the relatively unknown VT500 series starting in 1993.

In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization compression.

ReGIS, short for Remote Graphic Instruction Set, is a vector graphics markup language developed by Digital Equipment Corporation (DEC) for later models of their famous VT series of computer terminals. ReGIS supports rudimentary vector graphics consisting of lines, circular arcs, and similar shapes. Terminals supporting ReGIS generally allow graphics and text to be mixed on-screen, which makes construction of graphs and charts relatively easy.

<span class="mw-page-title-main">VT320</span> Computer terminal from Digital Equipment Corporation

The VT320 is an ANSI standard computer terminal introduced by Digital Equipment Corporation (DEC) in 1987. The VT320 is the text-only version, while the VT330 adds monochrome ReGIS, Sixel and Tektronix 4010 graphics, and the VT340 adds color.

<span class="mw-page-title-main">Waveform graphics</span>

Waveform graphics is a simple vector graphics system introduced by Digital Equipment Corporation (DEC) on the VT55 and VT105 terminals in the mid-1970s. It was used to produce graphics output from mainframes and minicomputers. DEC used the term "waveform graphics" to refer specifically to the hardware, but it was used more generally to describe the whole system.

References