Utah RLE

Also Known As: RLE

Type Bitmap
Colors 256
Compression RLE
Maximum Image Size 32Kx32K
Multiple Images Per File No
Numerical Format Little-endian
Originator University of Utah
Platform UNIX, others
Supporting Applications Utah Raster Toolkit, others
See Also Chapter 9, Data Compression

Primarily used in support of the Utah Raster Toolkit, though other applications, mainly on UNIX platforms, occasionally choose to support it.

A simple, well-defined and well-documented bitmap format. Too bad it's not in wider use. Consider using it in a pinch for interapplication exchange of 8-bit images if you have no alternative.

Vendor specifications are available for this format.

Code fragments are available for this format.

The Utah RLE format was developed by Spencer Thomas at the University of Utah Department of Computer Science. The first version appeared around 1983. The work was partially funded by the NSF, DARPA, the Army Research Office, and the Office of Naval Research. It was developed mainly to support the Utah Raster Toolkit (URT), which is widely distributed in source form on the Internet. Although superseded by more recent work, the Utah Raster Toolkit remains a source of ideas and bitmap manipulation code for many.

File Organization
File Details
For Further Information

Utah RLE was intended to be device-independent. Documentation associated with the URT claims that Utah RLE format files often require about one-third of the available space necessary for most "image synthesis"-style images. If the image data does not compress well, the format accommodates storage as uncompressed pixel data with little extra overhead. Despite its age, slightly idiosyncratic terminology, and some missing information, the Utah RLE format specification is well-written and reasonably clear. Aspiring format creators, take note!

File Organization

The file consists of a header, followed by palette information, a comment area, and the bitmap data.

File Details

The header looks like this:

typedef struct _RLE_Header
  WORD  Magic;          /* Magic number */
  SHORT Xpos;           /* Lower left x of image */
  SHORT Ypos;           /* Lower left y of image */
  SHORT Xsize;          /* Image width */
  SHORT Ysize;          /* Image height */
  BYTE  Flags;          /* Misc flags */
  BYTE  Ncolors;        /* Number of colors */
  BYTE  Pixelbits;      /* Number of bits per pixel */
  BYTE  Ncmap;          /* Number of color channels in palette */
  BYTE  Cmaplen;        /* Color map length  */
  BYTE  Redbg;          /* Red value of background color */
  BYTE  Greenbg;        /* Green value of background color */
  BYTE  Bluebg;         /* Blue value of background color */

Magic is, naturally enough, a magic number identifying the file type. Unfortunately, the magic number is not documented in the specification.

Xpos and Ypos are the position of the lower-left corner of the image, in pixels.

Xsize and Ysize are the size of the image, in pixels.

Flags is an 8-bit field used by the format writer to store miscellaneous information.

Ncolors is the total number of colors in the image, limited to 256.

Pixelbits provides information on the number of bits per pixel in the image. This is currently limited to 8.

Ncmap denotes the number of colors channels in the palette.

Cmaplen provides the number of bits in the palette and limits ncolors (defined above), the total number of colors in the image. For example, a cmaplen value of 8 denotes a 256-color palette.

Redbg, Greenbg, and Bluebg together provide a 24-bit specification of the image background color.

A key concept used in the Utah RLE format specification is that of the color channel. Each color channel contains eight bits, and the format supports up to 255 of them. This makes for an extremely flexible color model, but one, perhaps, that has never been utilized fully. Gray-scale images, for example, normally use one color channel; 24-bit RGB images use three channels; and RGBA, where an alpha channel is included, uses four channels.

The comment area is a series of null-terminated ASCII strings, each of which is preceded by a 16-bit length value. Each comment is WORD-aligned and is padded if necessary. Comments have the form:


The bitmap data is in stream format and is amply documented in the specification and the sample code.

For Further Information

For further information about the Utah RLE format, see the following article included on the CD-ROM:

Thomas, Spencer W., Design of the Utah RLE Format, University of Utah, Department of Computer Science.

See also the URT for actual implemention details.

The URT package may be obtained via FTP from the sites listed below.


You will find the package in the urt-3.0.tar.Z file, and sample images in urt-img.tar.Z.

URT is copyrighted, but is freely redistributable on a GNU-like basis. You can send questions about the URT or Utah RLE to either of the following:


Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.

Hosted by uCoz