Atari ST Graphics Formats

Also Known As: .ANI, .ANM, .CE1, .CE2, .CE3, .FLM, .UC1, .UC2, .UC3., NEO, .PAC, .PC1, .PC2, .PC3, PC3, .PI1, .PI2, .PI3, .RGB, .SEQ, .TNY, .TN1, .TN2, .TN3


Type Bitmap and animation
Colors Typically 16
Compression None and RLE
Maximum Image Size Typically 320x200 pixels
Multiple Images Per File Yes (animation formats only)
Numerical Format Big-endian
Originator Various Atari ST software developers
Platform Atari ST
Supporting Applications Many
See Also IFF

Usage
All of these formats are used by paint and animation packages found on the Atari ST.

Comments
The Atari ST, with its superior graphics capabilities, was a natural platform for development of multimedia, so much of the multimedia developments of today are based on these formats.

Vendor specifications are available for this format.

Code fragments are available for this format.


The Atari ST computer is the home of many sparsely documented image file formats. Many of these formats are used specifically for storing animation images and dumps of images displayed on the screen. Although the Electronic Arts IFF format is used by most Atari ST paint and animation programs, many software developers have devised their own special-purpose formats to fill their needs.

Contents:
File Organization and Details
For Further Information

File Organization and Details

This section contains a brief description of each of the Atari ST file formats; each format has its own file extension.

Animatic Film Format (.FLM)

The Animatic Film file format (file extension .FLM) stores a sequence of low-resolution 16-color images, which are displayed as an animation. Files in the .FLM format are stored as a header followed by one or more frames of image data. The header is 26 bytes in length and has the following format:

typedef struct _AnimaticFilmHeader
{
    WORD NumberOfFrames;      /* Number of frames in the animation */
    WORD Palette[16];         /* Color palette */
    WORD FilmSpeed;           /* Speed of playback */
    WORD PlayDirection;       /* Direction of play */
    WORD EndAction;           /* Action to take after last frame */
    WORD FrameWidth;          /* Width of frame in pixels */
    WORD FrameHeight;         /* Height of frame in pixels */
    WORD MajorVersionNumber;  /* Animatic major version number */
    WORD MinorVersionNumber;  /* Animatic minor version number */
    LONG MagicNumber;         /* ID number (always 27182818h) */
    LONG Reserved[3];         /* Unused (all zeros) */
} ANIMATICFILMHEADER;

NumberOfFrames specifies the total number of frames in the animation.

Palette is the color palette for the animation, stored as an array of 16 WORD values.

FilmSpeed is the number of delay (vblank) frames to display between each animation frame. The value of this field may be in the range 0 to 99.

PlayDirection is the direction the animation is played. Values for this field are 00h for forwards and 01h for backwards.

EndAction specifies the action to take when the last frame of the animation is reached during playback. A value of 00h indicates that the player should pause and then repeat the animation from the beginning. A value of 01h indicates that the animation should immediately repeat from the beginning (loop). A value of 03h indicates that playback should repeat in the reverse direction.

FrameWidth and FrameHeight are the size of the animation frames in pixels.

MajorVersionNumber and MinorVersionNumber contain the version number of the Animatic software that created the animation.

MagicNumber contains an identification value for Animatic Film files. This value is always 27182818h.

Reserved is 12 bytes of space reserved for future header fields. All bytes in this field have the value 00h.

ComputerEyes Raw Data Format (.CE1 and .CE2)

The ComputerEyes Raw Data Format is found in a low-resolution (file extension .CE1) and a medium-resolution (file extension .CE2) format. The header is 10 bytes in length and has the following format:

typedef struct _ComputerEyesHeader
{
    LONG Id;          /* Identification value (always 45594553h) */
    WORD Resolution;  /* Image data resolution */
    BYTE Reserved[8]; /* Miscellaneous data */
} COMPUTEREYESHEAD;

Id is a value used to identify a file as containing ComputerEyes-format data. The value of this field is always 45594553h or "EYES" as an ASCII string.

Resolution is the resolution of the image data stored in the file. This value is 00h for low-resolution data and 01h for high-resolution data.

Reserved is eight bytes of additional information, which is not needed for decoding the image data.

If the Resolution field value is 00h (low resolution), then the image data will be divided into three 320x220 RGB planes. Each plane is 64,000 bytes in size and is stored in red, green, blue order. The image data stores one pixel per byte, and only the lower six bits of each byte are used. Low-resolution image data is stored vertically, so rows of data are read along the Y-axis and not along the X-axis as in most other formats.

If the Resolution field value is 01h (high resolution), then the image data is stored in a single 640x480 plane, which is always 256,000 bytes in size. The image data stores one pixel per WORD, with the red value stored in bits 0 through 4, green in bits 5 through 9, and blue in bits 10 through 14. Bit 15 is not used. High-resolution image data is also stored along the vertical, rather than the horizontal, axis of the bitmap.

Cyber Paint Sequence Format (.SEQ)

The Cyber Paint Sequence file format (file extension .SEQ) is used for storing sequences of 16-color low-resolution images used in animations. Cyber Paint also supports an efficient form of delta-encoded data compression.

typedef struct _CyberPaintHeader
{
    WORD MagicNumber;                   /* Identification number */
    WORD VersionNumber;                 /* Version number */
    LONG NumberOfFrames;                /* Total number of frames */
    WORD DisplayRate;                   /* Display speed */
    BYTE Reserved[118];                 /* Unused */
    LONG FrameOffsets[NumberOfFrames];  /* Array of frame offsets */
} CUVERPAINTHEAD;

MagicNumber is an identification number used to indicate that the file contains Cyber Paint Sequence data. This value is typically FEDBh or FEDCh.

VersionNumber is the version number of the format.

NumberOfFrames specifies the number of data frames stored.

DisplayRate is the number of delay (vblank) frames to display between each animation frame.

Reserved is a 118-byte field reserved for future header fields. This field is set to a value of 00h.

FrameOffsets is an array of LONG offset values with a number of elements equal to the value stored in the NumberOfFrames field. Each offset value indicates the starting position of each frame, calculated from the beginning of the file.

Each frame contains a header of descriptive information in the following format:

typedef struct _CyberPaintFrame
{
    WORD Type;            /* Frame type */
    WORD Resolution;      /* Frame Resolution */
    WORD Palette[16];     /* Color palette */
    BYTE FileName[12];    /* Name of frame data file */
    WORD Limits;          /* Color animation limits */
    WORD Speed;           /* Color animation speed and direction */
    WORD NumberOfSteps;   /* Number of color steps */
    WORD XOffset;         /* Left position of frame on display */
    WORD YOffset;         /* Top position of frame on display */
    WORD FrameWidth;      /* Width of the frame in pixels */
    WORD FrameHeight;     /* Height of the frame in pixels */
    BYTE Operation;       /* Graphics operation */
    BYTE Compression;     /* Data storage method */
    LONG DataSize;        /* Length of the frame data in bytes */
    BYTE Reserved[60];    /* Unused */
} CYBERPAINTFRAME;

Type is an identification value identifying the header as belonging to a frame.

Resolution is the resolution of the frame data and is usually 00h.

Palette is an array of values for the 16-color palette for this frame.

FileName stores the name of the disk file in which the frame data is stored. The default string stored in this field is `` . '', which indicates no filename.

Limits is the color animation limits of the frame.

Speed specifies the speed and direction of the playback.

NumberOfSteps is the number of color steps in the image data.

XOffset is the left position of the frame on the display. This value may be in the range of 0 to 319.

YOffset is the top position of the frame on the display. This value may be in the range of 0 to 199.

FrameWidth and FrameHeight are the size of the frame in pixels.

Operation is the graphics operation to perform on the frame data. A value of 00h indicates copy, and a value of 01h indicates an exclusive OR.

Compression indicates whether the frame data is compressed (a value of 01h) or uncompressed (a value of 00h).

DataSize is the actual size of the data (compressed or uncompressed) stored in the frame.

Reserved is a 60-byte field reserved for future header fields. All bytes in this field have the value 00h.

Frame data stored in a Sequence file is always 320x200 pixels. The frame data is stored as four bitplanes, with one pixel stored per WORD. Pixels are always stored along the vertical (Y) axis of the bitmap. Therefore, the first 200 bytes of frame data are the first pixels of the first bitplane of the frame, and so on.

Frame data may be compressed using a delta-encoding algorithm. Using this technique, only the changes between frames are actually encoded. Interframe data that does not change is not saved.

The first frame in a sequence is always stored in its entirety. You have to start someplace. Each frame thereafter is compared to the previous frame, and only the X and Y coordinates of rectangular regions of pixel values (called change boxes) that have changed are saved. Only one change box is stored per frame.

Each change box may be stored in one of five different variations, always using the variation that yields the best compression for a particular change box. These variations are:

Compressed data contains a sequence of control WORDs (16-bit signed WORDs) and data. A control WORD with a value between 1 and 32,767 indicates that the next WORD is to be repeated a number of times equal to the control WORD value. A control WORD with a negative value indicates that a run of bytes equal to the absolute value of the control WORD value is to be read from the compressed data.

DEGAS Format (.PI1, .PI2, .PI3, .PC1, .PC2, .PC3)

The DEGAS animation file format actually occurs in three different variations. The DEGAS and DEGAS Elite formats support low, medium, and high-resolution graphics data (files have the extension .PI1, .PI2, and .PI3 respectively). The DEGAS Elite Compressed format supports low, medium, and high-resolution graphics data (files have the extension .PC1, .PC2, and .PC3 respectively), and it also supports data compression.

The DEGAS format stores only a single image of the display. The header is 34 bytes long and is followed by 32,000 bytes of image data:

typedef struct _DegasHeader
{
    WORD Resolution;      /* Image resolution */
    WORD Palette[16];     /* Color palette */
} DEGASHEAD;

Resolution is the resolution of the image data stored as a bit-field. Valid values are:

00h Left
01h Off
02h Right

Palette is an array of 16 WORD values that holds the color palette for the image.

The DEGAS Elite format contains the same header and image data structure as the DEGAS format. It differs form the DEGAS format in that it has a 32-byte footer containing additional information:

typedef struct _DegasEliteFooter
{
    WORD LeftColor[4];    /* Left color animation limit table */
    WORD RightColor[4];   /* Right color animation limit table */
    WORD Direction[4];    /* Animation channel direction flag */
    WORD Delay[4];        /* Animation channel delay */
} DEGASELITEFOOT;

LeftColor stores the left color animation limit table containing the starting color numbers for the animation.

RightColor stores the right color animation limit table containing the ending color numbers for the animation.

Direction contains the animation channel direction bit-field flag. Valid values are:

00h Left
01h Off
02h Right

Delay is the animation channel delay rate between frames. This value is measured in 1/60 of a second and is subtracted from the constant 128 to calculate this value.

The DEGAS Elite Compressed format contains the same header and footer as the DEGAS Elite format, with one variation in the header data.

The Resolution field uses the following bit values to indicate the resolution of the image data:

8000h Low resolution
8001h Medium resolution
8002h High resolution

The compression algorithm used is identical to RLE scheme found in the Interchange file format (IFF); see the article on the Interchange format for details.

RGB Intermediate Format (.RGB)

The RGB Intermediate Format (file extension .RGB) is actually three low-resolution DEGAS .PI1 files concatenated into a single file. The pixel data in each plane contains an actual red, green, or blue color-channel value rather than an index into the 16-color palette. On the Atari ST, there are only three bits per color channel. The Atari ST with the extended color palette uses four bits per color channel.

The structure of an entire RGB file is shown here:

struct _RgbFile
{
    WORD RedResolution;     /* Red plane resolution (ignored) */
    WORD RedPalette[16];    /* Red plane palette (ignored) */
    WORD RedPlane[16000];   /* Red plane data */
    WORD GreenResolution    /* Green plane resolution (ignored) */
    WORD GreenPalette       /* Green plane palette (ignored) */
    WORD GreenPlane[16000]; /* Green plane data */
    WORD BlueResolution;    /* Blue plane resolution (ignored) */
    WORD BluePalette;       /* Blue plane palette (ignored) */
    WORD BluePlane[16000];  /* Blue plane data */
}

Imagic Film/Picture Format (.IC1, .IC2, .IC3)

The Imagic Format stores low-, medium-, and high-resolution image data using the file extensions .IC1, .IC2, and .IC3 respectively. The header is 49 bytes long and is formatted as follows:

typedef struct _ImagicHeader
{
    BYTE Id[4];             /* File identification value */
    WORD Resolution;        /* Image resolution */
    WORD Palette[16];       /* Color palette */
    WORD Date;              /* Date stamp */
    WORD Time;              /* Time stamp */
    BYTE Name[8];           /* Base file name */
    WORD Length;            /* Length of data */
    LONG Registration;      /* Registration number */
    BYTE Reserved[8];       /* Unused */
    BYTE Compression;       /* Data compression flag */
} IMAGICHEAD;

Id is the identification value for this format and contains the characters IMDC.

Resolution specifies the resolution of the image data. Values are:

00h Low resolution
01h Medium resolution
02h High resolution

Palette is an array of 16 elements storing the color palette for this image.

Date and Time contain a date and time stamp indicating when the file was created. These stamps are in GEMDOS (Atari native operating system) format.

Name is the base filename of the image file.

Length is the length of the image data stored in the file.

Registration is the registration number of the Imagic application program which created the image file.

Reserved is an 8-byte field which is unused and set to a value of 00h.

Compression indicates whether the image data is compressed. A value of 00h indicates no compression, while a value of 01h indicates that the image data is compressed.

Image data may be run-length encoded (RLE) or delta compressed. Delta compression results in smaller animation files than RLE, although on complex images RLE works better.

NEOchrome Format (.NEO)

NEOchrome image files have the file extension .NEO and contain a 79-byte header followed by 16,000 bytes of image data. The format of the header is as follows:

typedef struct _NeochromeHeader
{
    WORD Flag;             /* Flag byte (always 00h) */
    WORD Resolution;       /* Image resolution */
    WORD Palette[16];      /* Color palette */
    CHAR FileName[12];     /* Name of image file */
    WORD Limits;           /* Color animation limits */
    WORD Speed;            /* Color animation speed and direction */
    WORD NumberOfSteps;    /* Number of color steps */
    WORD XOffset;          /* Image X offset (always 00h) */
    WORD YOffset;          /* Image Y offset (always 00h) */
    WORD Width;            /* Image width (always 320) */
    WORD Height;           /* Image height (always 200) */
    WORD Reserved[33];     /* Reserved (always 00h) */
} NEOCHROMEHEAD;

Flag is a collection of flag bits and is always set to a value of 00h.

Resolution specifies the resolution of the image data. Values are:

00h Low resolution
01h Medium resolution
02h High resolution

Palette is the color palette for this image stored as an array of 16 WORD values.

FileName is the name of the image file. The default string for this field is `` . '' .

Limits specifies the color animation limits of the image. Bits 0 through 3 specify the value of the upper-right limit, and bits 4 through 7 specify the value of the lower-left limit. Bit 15 is set to 1 if the animation data is valid.

Speed specifies the color animation speed and direction. Bits 0 through 7 specify the speed of the playback in number of blank frames displayed per animation frame. Bit 15 indicates the direction of playback. A value of 0 indicates normal and a value of 1 indicates reversed.

NumberOfSteps is the number of frames in the animation.

XOffset and YOffset are the starting coordinates of the image on the display. These values are always 00h.

Width is the width of the image in pixels. This value is always 320.

Height is the height of the image in pixels. This value is always 200.

Reserved is a field of 33 bytes reserved for future header fields. All bytes in this field are set to 00h.

NEOchrome Animation Format (.ANI)

NEOchrome Animation files have the file extension .ANI and contain a header followed by a sequence of one or more frames of animation data stored in their playback order. The header is 22 bytes and is formatted as follows:

typedef struct _NewchromeAniHeader
{
    LONG MagicNumber;      /* ID value (always BABEEBEAh) */
    WORD Width;            /* Width of image in bytes */
    WORD Height;           /* Height of image in scan lines */
    WORD Size;             /* Size of image in bytes + 10 */
    WORD XCoord;           /* X coordinate of image */
    WORD YCoord;           /* Y coordinate of image - 1 */
    WORD NumberOfFrames;   /* Total number of frames */
    WORD Speed;            /* Animation playback speed */
    LONG Reserved;         /* Reserved (always 00h) */
} NEWCHROMEANIHEAD;

MagicNumber is the identification value for Neochrome animation files. This value is always BABEEBEAh.

Width is the width of the animation in pixels. This value must always be divisible by 8.

Height is the height of the animation frames in pixels (scan lines).

Size is the total size of a frame in bytes, plus 10.

XCoord specifies the left position of the image in pixels, minus one. This value must be divisible by 16.

YCoord specifies the top position of the image in pixels, minus one.

NumberOfFrames specifies the number of image frames in the animation.

Speed specifies the playback speed of the animation in number of blank frames displayed per image frames.

Reserved is an unused field, which is set to 00h.

STAD Format (.PAC)

The STAD image file format has the file extension .PAC. It contains a header followed by a single block of RLE-compressed image data. The header is seven bytes in size and contains only information necessary to decompress the image data. The format of the header is as follows:

typedef struct _StadHeader
{
    CHAR Packed[4];       /* Packing orientation of image data */
    BYTE IdByte;          /* RLE ID value of a 'PackByte' run */
    BYTE PackByte;        /* The value of a 'PackByte' run */
    BYTE SpecialByte;     /* RLE ID value of a non-'PackByte' run */
} STADHEADER;

Packed contains the characters pM86 if the image data in the file is vertically packed, or pM85 if it is horizontally packed.

IdByte is a value used to indicate an RLE byte run that uses the PackByte value.

PackByte is the most frequently occurring byte value in the image data.

SpecialByte is a value used to indicate an RLE byte run using a value stored in the image data.

The image data in a STAD file is always compressed using a simple RLE algorithm. STAD is a bit unique in that it allows the option of packing image data either horizontally along the bitmap (with the scan lines), or vertically down the bitmap (across the scan lines). The direction of the encoding is specified in the Packed field in the header.

The most frequently occurring byte value in the image data is stored in the PackByte field of the header. This reduces the size of the compressed data by not requiring this value to be redundantly stored in the compressed image data itself.

The STAD RLE algorithm uses three types of packets:

Following is a simple, pseudo-code description of the RLE decoding process:


    Read a byte
        If the byte is the IdByte value
            Read a byte (the RunCount)
            Repeat the PackByte value RunCount + 1 times else
        If the byte is the SpecialByte value
            Read a byte (the RunValue)
            Read a byte (the RunCount)
            Repeat the RunValue RunCount times
        else
            Use the byte value literally.

Tiny Format (.TNY, .TN1, .TN2, .TN3)

The Tiny format (.TNY) is similar to the NEOchrome formats. Tiny files may contain low (.TN1), medium (.TN2), or high (.TN3) resolution image data.

Tiny files may have one of two different header formats. The most common is 37 bytes in length and is formatted as follows:

typedef struct _TinyHeader
{
    BYTE Resolution;        /* Resolution of the image data */
    WORD Palette[16];       /* Color palette */
    WORD ControlBytes;      /* Number of control bytes */
    WORD DataWords;         /* Number of data words */
} TINYHEAD;

Resolution specifies the resolution of the image data. Values are:

00h Low resolution
01h Medium resolution
02h High resolution

Palette is the 16-color palette of the image data.

ControlBytes is the number of control bytes found in the image data. This value is in the range of 3 to 10,667.

DataWords is the number of WORDs of image data stored in the file. This value is in the range of 1 to 16,000.

If the value of the Resolution field is 03h or greater, the Tiny header has the following format:

typedef struct _TinyHeader
{
    BYTE Resolution;        /* Resolution of the image data */
    BYTE Limits;            /* Color animation limits */
    BYTE Speed;             /* Speed and direction of playback */
    WORD Duration;          /* Color rotation duration */
    WORD Palette[16];       /* Color palette */
    WORD ControlBytes;      /* Number of control bytes */
    WORD DataWords;         /* Number of data words */
} TINYHEAD;

Limits specifies the left and right color animation limits. Bits 0 through 3 store the right (end) limit value, and bits 4 through 7 store the left (start) limit value.

Speed specifies the speed and direction of the animation playback. A negative value indicates left playback, and a positive value indicates right playback. The absolute value is the speed (delay between frames) in increments of 1/60 of a second.

Duration specifies the color rotation duration (number of iterations).

ControlBytes specifies the size of a BYTE array that follows the header. This array contains control values used to specify how the Tiny image data is to be uncompressed.

DataWords specifies the number of data words in the image data. The run-length encoded image data follows the control-value array. Tiny image data is uncompressed by reading a control value and then, based on the control value, performing an action on the encoded data.

If a control value is negative, then the absolute value of the control value indicates the number of WORDs to read literally from the compressed data. If a control value is equal to zero, another control value is read, and its value (128 to 32767) is used to specify the number of times to repeat the next data WORD. If a control value is equal to one, another control value is read and its value (128 to 32767) is used to specify the number of literal WORDs to read from the data section. And a control value greater than one specifies the number of times to repeat the next WORD read from the data section (two to 127).

The uncompressed image data is stored along its Y-axis in a fashion identical to many other Atari image file formats.

For Further Information

Although we have not been able to obtain an official specification document from Atari, the article included on the CD-ROM contains detailed information about the Atari ST graphics file formats. See the following:

Baggett, David M., Atari ST Picture Formats.

The author has also kindly agreed to be a resource for information about the Atari ST format files. Contact:

David M. Baggett
Email: dmb@ai.mit.edu

You may also find Atari information at:

comp.sys.atari.st

USENET newsgroup

http://newton.ex.ac.uk/general/ug/jones/

Dan's Atari ST web pages

http://www.smartpages.com/faqs/csas-faq/top.html

Atari ST FAQ



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