CALS Raster

Also Known As: CALS, CAL, RAS

Type Bitmap
Colors Mono
Compression CCITT Group 4, uncompressed
Maximum Image Size Unlimited
Multiple Images Per File Yes (Type II only)
Numerical Format NA
Originator U.S. Department of Defense
Platform All
Supporting Applications Too numerous to list
See Also None

Compound document exchange, DTP, CAD/CAM, image processing.

A well-documented, though cumbersome, format that attempts to do many things. If you are unfamiliar with U.S. government specification documents, you will probably find working with this format a complicated and challenging task. CALS raster is mandatory for use in most U.S. government document-handling applications. Because all data is byte-oriented, big-endian versus little-endian problems never arise.

Sample images are available for this format.

The CALS raster format is a standard developed by the Computer Aided Acquisition and Logistics Support (CALS) office of the United States Department of Defense to standardize graphics data interchange for electronic publishing, especially in the areas of technical graphics, CAD/CAM, and image processing applications.

File Organization
File Details
For Further Information

CALS is also an Office Document Interchange Format (ODIF) used in the Office Document Architecture (ODA) system for the exchange of compound document data between multiple machine platforms and software applications. CALS is an attempt to integrate text, graphics, and image data into a standard document architecture. Its ultimate goal is to improve and integrate the logistics functions of the military and its contractors.

All technical publications for the federal government must conform to the CALS standard. Many other government organizations are also quickly adopting CALS. Commercial businesses, such as the medical, telecommunications, airline, and book publishing industries have also standardized on CALS.

CALS has also come into wide use in the commercial computer industry, such as in CAD/CAM applications, and in the aerospace industry, which owes a large part of its business to government and military contracts. CALS-compliant technical illustration systems also use the PostScript Page Description Language and Encapsulated PostScript files to exchange data between themselves and commercial systems.

File Organization

There are two types of CALS raster formats as defined by MIL-STD-28002A. They are specified as the Type I and Type II raster formats. Type I raster data files contain a single, monochrome image compressed using the CCITT Group 4 (T.6) encoding algorithm and appended to a CALS raster header record data block.

Type II image files contain one or more monochrome images that are also stored using the CCITT Group 4 encoding algorithm. In addition, the Type II format supports the encoding of image data as a collection of pel tiles. Each tile of image data is either separately encoded using CCITT Group 4 or is stored in its raw, unencoded format. The location of each tile within the image is stored in a tile offset index, for convenient retrieval of individual tiles. For further detail on the CALS Type II raster graphics format, refer to MIL-R-28002A.

The structures of the two CALS variants, Type I and Type II, are shown below.

The Type I file format consists of the following:

Image Data

The Type II file format looks like this:

Document Profile
Presentation Styles
Document Layout
Root Layout
   Layout Object Page 1
      Tile Index
      Image Data
   Layout Object Page 2
      Tile Index
      Image Data
   Layout Object Page N
      Tile Index
      Image Data

As you can see, the Type II format is considerably more complex than the Type I. Each Type II file may contain one or more pages of image data. There is also a considerable amount of page and document formatting data present in a Type II file. But by far the most common use of the Type II format is simply to store a collection of Type I CALS raster images in the same physical file. In such an arrangement, all the image pages are untiled, CCITT Group 4 encoded, and the profile, style, and layout information are omitted.

The raster data in a Type I file is always encoded using the CCITT Group 4 encoding method. CCITT Group 3 encoded and unencoded data is not supported. Type II files may contain tiles that are either CCITT Group 4 encoded or raw, unencoded data. Both raw and encoded tiles may occur in the same Type II CALS file and are always 512 pels in size. If the end of the image is reached before a tile is completely encoded, then this partial tile is completed by adding padding.

Two other types of tiles found in Type II images are null foreground and null background tiles. Null tiles are entirely white or entirely black, depending upon the designated background and foreground colors. They are actually pseudo-tiles that are not present in the image data and have no tile offset value.

Tile data is stored in the image data along the pel path (rows) and down the line progression (columns). Storage of randomly distributed tiles is possible, but discouraged. Tiles are normally encoded, unless the image data is so complex that the time required to encode the image is too great or unless very little reduction in the size of the data would result if the tile were encoded. The inclusion of unencoded data in a T.6-encoded data stream is not supported by the CALS raster format.

File Details

This section contains detailed information about the components of a CALS raster file.

Header Record Data Block

The CALS raster header is different from most other graphics file format headers in that it is composed entirely of 7-bit ASCII characters in a human-readable format. When most graphics image files are displayed as a text file, seemingly random garbage is displayed on the screen. Listing a CALS raster file, however, will reveal ASCII information which is quite understandable to a human reader. The unintelligible garbage following the header is the compressed image data.

The CALS raster data file header is 1408 bytes and is divided into eleven 128-byte records. Each record begins with a predefined 7-bit ASCII record identifier that is followed by a colon. The remaining part of the 128-byte record is the record information. If a record contains no information, the character string NONE is found in the record. The remainder of the bytes in each record contain space characters (ASCII 32) as filler. All data in the header block is byte-oriented, so no adjustments need to be made for byte order.

Following the last record in the header is 640 bytes of padding that rounds the header out to a full 2048 bytes in length. In fact, the raster image data always begins at offset 2048. Although this padding is not actually defined as part of the header, additional records added to future versions of the CALS header would be placed in this area. The byte value used for the padding is usually a space character (ASCII 20h), but any ASCII character can be used.

The structure for the CALS raster header block is shown below.

typedef struct _CalsHeader
CHAR  SourceDocId[128];         /* Source Document Identifier   */
CHAR  DestDocId[128];           /* Destination Document ID  */
CHAR  TextFileId[128];          /* Text File Identifier   */
CHAR  FigureId[128];            /* Table Identifier   */
CHAR  SourceGraph[128];         /* Source System Filename   */
CHAR  DocClass[128];            /* Data File Security Label   */
CHAR  RasterType[128];          /* Raster Data Type   */
CHAR  Orientation[128];         /* Raster Image Orientation   */
CHAR  PelCount[128];            /* Raster Image Pel Count   */
CHAR  Density[128];             /* Raster Image Density   */
CHAR  Notes[128];               /* Notes   */
CHAR  Padding[640];             /* Pad header out to 2048-bytes   */

Image record identifiers

Each record in a CALS raster file starts with a record identifier, which is a string of ASCII characters followed by a colon and a single space. Record data immediately follows the record identifier. If the record does not contain any relevant data, then the ASCII string NONE is written after the identifier.


SourceDocId starts with the source system document identifier (srcdocid). This record is used by the source system (the system on which the document was created) to identify the document to which the image is attached. This identifier can be a document title, publication number, or other similar information.


DestDocId starts with the destination system document identifier (dstdocid). This record contains information used by the destination organization to identify the document to which the image is attached. This record may contain the document name, number or title, the drawing number, or other similar information.


TextFileId starts with the text file identifier (txtfilid). This record contains a string indicating the document page that this image page contains. A code is usually found in this record that identifies the section of the document to which the image page belongs. Such codes may include:

COV Cover or title page
LEP List of effective pages
WRN Warning pages
PRM Promulgation pages
CHR Change record
FOR Forword or preface
TOC Table of contents
LOI Lists of illustrations and tables
SUM Safety Summary
PTn Part number n
CHn Chapter number n
SEn Section number n
APP-n Appendix n
GLS Glossary
INX Index
FOV Foldout section


FigureId starts with the figure or table identifier (figid). This is the number by which the image page figure is referenced. A sheet number is preceded by the ASCII string -S and followed by the drawing number. A foldout figure is preceded by the ASCII string -F and followed by the number of pages in the foldout.


SourceGraph starts with the source system graphics filename (srcgph). This record contains the name of the image file.


DocClass starts with the data file security label (doccls). This record identifies the security level and restrictions that apply to this image page and/or associated document.


RasterType starts with the raster data type (rtype). This is the format of raster image data that follows the header record data block in this file. This record contains the character 1 for Type I raster data and 2 for Type II raster data.


Orientation starts with the raster image orientation identifier (rorient). This record indicates the the proper visual orientation of the displayed image. This data is represented by two strings of three numeric characters separated by a comma. The first three characters are the direction of the pel path of the image page. Legal values are 0, 90, 180, and 270 representing the number of degrees the image was rotated clockwise from the origin when scanned. A page scanned normally has a pel path of 0 degrees, while an image scanned in upside-down has a pel path of 180 degrees.

The second three characters represent the direction of line progression of the document. Allowed values are 90 and 270 representing the number of degrees clockwise of the line progression from the pel path direction. A normal image has a line progression of 270, while a mirrored image has a line progression of 90.


PelCount starts with the raster image pel count identifier (rpelcnt). This record indicates the width of the image in pels and the length of the image in scan lines. This data is represented by two strings of six numeric characters separated by a comma. Typical values for this record are shown in Table CALS Raster-1.

Table CALS Raster-1: Typical CALS Raster Pel Count Values

Drawing Size

Pels Per Line, Number of Lines














Density starts with the raster image density identifier (rdensity). This density is a single four-character numeric string representing the numerical density value of the image. This record may contain the values 200, 240, 300, 400, 600, or 1200 pels per inch, with 300 pels per inch being the default.


Notes starts with the notes identifier (notes). This is a record used to contain miscellaneous information that is not applicable to any of the other records in the CALS raster file header.


This section contains an example of a CALS raster file header data block created by a facsimile (FAX) software application. This image file contains a single page of a facsimile document received via a computer facsimile card and stored to disk as a CALS raster image file.

The source of the document is identified as FAX machine number one. The destination is an identification number used to index the image in a database. The ID number is constructed from the date the FAX was received, the order in which it was received (e.g., it was the third FAX received that day), and the total number of pages. The text file identifier indicates that this file is page three of a seven-page facsimile document, for example.

The figure record is not needed, so the ASCII string NONE appears in this field. The source graphics filename contains the MS-DOS filename of the CALS raster file in which the page is stored. The remaining records indicate that the FAX document is unclassified, contains Type I CALS raster image data, has a normal orientation, and that the size and density of the image correspond to that of a standard facsimile page. The Notes field contains a time stamp showing when the FAX was actually received.

Please note that this is only one possible way that data may appear in a CALS header block. Most government and military software applications create CALS header blocks that are far more cryptic and confusing than this example. On the other hand, several CAD packages create simpler CALS headers.

Following is an example of a CALS header record data block:

srcdocid:    Fax machine #1  
dstdocid:    910814-003.007
txtfilid:    003,007
figid:       NONE
srcgph:      F0814003.007
doccls:      Unclass
rtype:       1
rorient:     000,270
rpelcnt:     001728,002200
rdensity:    0200
notes:       Fri Aug 14 12:21:43 1991 PDT

For Further Information

Information about the CALS raster format is found primarily in the following military standards documents:

Automated Interchange of Technical Information, MIL-STD-1840A. This document contains a description of the header (called a header record data block) in the CALS format.

Requirements for Raster Graphics Representation in Binary Format, MIL-R-28002A. This document contains a description of the image data in the CALS format.

Also, see the CALS homepage at:

The CALS raster file format is supported through the following office of the Department of Defense:

CALS Management Support Office (DCLSO)
Office of the Assistant Director for Telecommunications
and Information Systems
Headquarters Defense Logistics Agency
Cameron Station
Alexandria, VA 22314

The documents MIL-STD-1840 and MIL-R-28002A may be obtained from agencies that distribute military specifications standards, including the following:

Standardization Documents Ordering Desk
Building 4D
700 Robbins Avenue
Philadelphia, PA 19111-5094

Global Engineering Documents
2805 McGaw Avenue
Irvine, CA 92714
Voice: 800-854-7179
Voice: 714-261-1455

Useful and readily available periodical articles on CALS and ODA include the following:

Dawson, F., and F. Nielsen, "ODA and Document Interchange," UNIX Review, vol. 8, no. 3, 1990, p. 50.

Hobgood, A., "CALS Implementation--Still a Few Questions," Advanced Imaging, April 1990, pp. 24-25.

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

Hosted by uCoz