=========================================================================
 
INFO-ATARI16 Digest         Tue,  2 Jan 90       Volume 89 : Issue    2
 
Today's Topics:
                       New Picture Formats List
----------------------------------------------------------------------
 
Date: Sat, 30 Dec 89 19:38:03 -0500
From: David M. Baggett <dmb@TIS.COM>
Subject: New Picture Formats List
Message-ID: <8912310038.AA19962@TIS.COM>
 
Welcome to the last posting of "The List" in the 1980's.  Thanks to
Roland Waldi, 7 new formats have been added.  At Roland's suggestion,
standard filename extensions are now listed as well.
 
Minor changes have been made to the DEGAS Elite description.  (Color
animation delay was incorrect.)  Additionally, I've discovered some
unpleasant caveats with compressed DEGAS Elite pics which are now
documented.
 
New formats include:
 
GEM Bit Image, Image, Doodle, STAD, Imagic Film/Picture, Art Director, IFF
 
Please take a look at these new ones and report any glaring problems.
 
Happy new year!
 
Dave Baggett
(dmb@TIS.COM)
-------------------------------- >8 ----------------------------------------
 
 
                           ST Picture Formats
                           ------------------
                              Compiled by:
                              Dave Baggett
                         (arpanet: dmb@TIS.COM)
 
                   (Please report errors or additions)
 
                              CONTRIBUTORS
 
      Phil Blanchfield  Jason Blochowiak  David Brooks  Neil Forsyth
   Stefan Hoehn  Ken MacLeod   Jim McCabe  Darek Mihocka  David Mumper
    George Seto  Joe Smith  Greg Wageman  Roland Waldi* Gerry Wheeler
 
                                Contents
                                --------
 
        NEOchrome                               *.NEO
        NEOchrome Animation                     *.ANI
        DEGAS                                   *.PI?   ? = 1, 2, 3
        DEGAS Elite                             *.PI?   ? = 1, 2, 3
        DEGAS Elite (Compressed)                *.PC?   ? = 1, 2, 3
        Tiny                                    *.TN?   ? = 1, 2, 3, Y
        Spectrum 512                            *.SPU
        Spectrum 512 (Compressed)               *.SPC
        Art Director                            *.ART
        C.O.L.R. Object Editor Mural            *.MUR
        Doodle                                  *.DOO
        Animatic Film                           *.FLM
        GEM Bit Image                           *.IMG
        Image                                   *.IMG
        STAD                                    *.PAC
        Imagic Film/Picture                     *.IC?   ? = 1, 2, 3
        IFF                                     *.IFF
        MacPaint
 
 
                        Introductory Information
                        ------------------------
word    = 2 bytes
long    = 4 bytes
palette = Hardware color palette, stored as 16 words.  First word is
          color register zero (background), last word is color register
          15.  Each word has the form:
 
          Bit:  (MSB) 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (LSB)
                      -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
                       0  0  0  0  0 R2 R1 R0  0 G2 G1 G0  0 B2 B1 B0
 
          R2 = MSB of red intensity
          R0 = LSB of red intensity
 
          G2 = MSB of green intensity
          G0 = LSB of green intensity
 
          B2 = MSB of blue intensity
          B0 = LSB of blue intensity
 
          Intensity ranges from 0 (color not present) to 7 (highest
          intensity).
 
          Example: ? red = 7, green = 3, blue = 5 ? -> 0735 (hex)
 
          Caveat:  It is wise to mask off the upper four bits of each
                   palette entry, since a few programs store special
                   information there (most notably Art Studio).
 
 
                             The Formats
                             -----------
 
<NEOchrome>     *.NEO
 
1 long          resolution (0 = low res, 1 = medium res, 2 = high res)
16 words        palette
12 bytes        filename (usually "        .   ")
1 byte          unused (?) (usually either 80 hex or 0)
1 byte          color animation limits (4 most significant bits are
                left/lower limit; 4 least significant bits are
                right/upper limit).
1 byte          color animation enabled?  High bit set if yes.
1 byte          color animation speed and direction
                x = 0 means animation stopped
                x < 0 means colors cycle to the left (decreasing)
                x > 0 means colors cycle to the right (ascending)
                Number of vblanks between cycles is |x| - 1
19 longs        reserved for expansion
16000 words     picture data (screen memory)
-----------
32128 bytes     total
 
 
<NEOchrome Animation>        *.ANI
 
NOTE:      To get this feature on versions 0.9 and later select the Grabber
        icon and click both mouse buttons in the eye of the second R in the
        word GRABBER.
           Interestingly enough, some versions of NEO only require you
        to press the right button, not both.  Hmmm...
 
1 long          magic number BABEEBEA (hex) (seems to be ignored)
1 word          width of image in bytes (always divisible by 8)
1 word          height of image in scan lines
1 word          size of image in bytes + 10 (!)
1 word          x coordinate of image (must be divisible by 16) - 1
1 word          y coordinate of image - 1
1 word          number of frames
1 word          animation speed (# vblanks to delay between frames)
1 long          reserved; should be zero
--------
22 bytes        total for header
 
? words         image data (words of screen memory) for each frame, in
                order
 
 
<DEGAS>         *.PI1 (low resolution)
                *.PI2 (medium resolution)
                *.PI3 (high resolution)
 
1 word          resolution (0 = low res, 1 = medium res, 2 = high res)
                Other bits may be used in the future; use a simple bit
                test rather than checking for specific word values.
16 words        palette
16000 words     picture data (screen memory)
-----------
32034 bytes     total
 
 
<DEGAS Elite>   *.PI1 (low resolution)
                *.PI2 (medium resolution)
                *.PI3 (high resolution)
 
1 word          resolution (0 = low res, 1 = medium res, 2 = high res)
                Other bits may be used in the future; use a simple bit
                test rather than checking for specific word values.
16 words        palette
16000 words     picture data (screen memory)
4 words         left color animtion limit table (starting color numbers)
4 words         right color animation limit table (ending color numbers)
4 words         animation channel direction flag (0 = left, 1 = off, 2 = right)
4 words         128 - animation channel delay in 1/60's of a second. [0 - 128]
                (I.e., subtract word from 128 to get 1/60th's of a second.)
-----------
32066 bytes     total
 
 
<DEGAS Elite (Compressed)>      *.PC1 (low resolution)
                                *.PC2 (medium resolution)
                                *.PC3 (high resolution)
 
1 word          resolution (same as Degas, but high order bit is set;
                i.e., hex 8000 = low res, hex 8001 = medium res,
                hex 8002 = high res).  Other bits may be used in the
                future; use a simple bit test rather than checking
                for specific word values.
16 words        palette
< 32000 bytes   control bytes
4 words         left color animtion limit table (starting color numbers)
4 words         right color animation limit table (ending color numbers)
4 words         animation channel direction flag (0 = left, 1 = off, 2 = right)
4 words         128 - animation channel delay in 1/60's of a second. [0 - 128]
                (I.e., subtract word from 128 to get 1/60th's of a second.)
-----------
< 32066 bytes   total
 
Control byte meanings:
 
        For a given control byte, x:
 
        0 <= x <= 127   Use the next x + 1 bytes literally (no repetition)
        -127 <= x <= -1 Use the next byte -x + 1 times
        -128            No operation (not used)
 
Compression Scheme:
 
   Each scan line is compressed separately; i.e., all data for a given
scan line appears before any data for the next scan line.  The scan lines
are specified from top to bottom (i.e., 0 is first).  For each scan line,
all the data for a given bit plane appears before any data for the next
higher order bit plane.
   To clarify:  The first data in the file will be the data for the highest
order bit plane of scan line zero, followed by the data for the next lower
order bit plane of scan line zero, etc., until all bit planes have been
specified for scan line zero.  The next data in the file will be the data
for the highest order bit plane of scan line one, followed by the data for
the next lower order bit plane of scan line one, etc., until all bit planes
have been specified for all scan lines.
 
Caveats:
 
   DEGAS Elite's picture loading routine places some restrictions on
compressed DEGAS files:
 
        o Elite uses a 40-byte buffer to store data being decompressed.
 
        o Whenever a control command is encountered, bytes are stuffed
        in this buffer.
 
        o The buffer is only emptied when there are EXACTLY 40
        characters in it.
 
The important conclusion here is that
 
        No control command may cause the buffer to have more than 40
        bytes in it.  In other words, all control commands must end on
        or before the 40-byte boundary.
 
Any picture violating the last condition will cause Elite to get a bus
error when the picture is loaded.
 
 
<Tiny>  *.TNY (any resolution)
        *.TN1 (low resolution)
        *.TN2 (medium resolution)
        *.TN3 (high resolution)
 
   Several people have reported sightings of mutated Tiny pictures that
do not follow the standard format, so let's be careful out there.  What
is described here is the format that David Mumper's original
TNYSTUFF.PRG produces.
 
1 byte          resolution (same as NEO, but +3 indicates rotation
                information also follows)
 
If resolution > 2 ?
1 byte          left and right color animation limits.  High 4 bits
                hold left (start) limit; low 4 bits hold right (end)
                limit
1 byte          direction and speed of color animation (negative value
                indicates left, positive indicates right, absolute value
                is delay in 1/60's of a second.
1 word          color rotation duration (number of iterations)
?
 
16 words        palette
1 word          number of control bytes
1 word          number of data words
3-10667 bytes   control bytes
1-16000 words   data words
-------------
42-32044 bytes  total
 
Control byte meanings:
 
        For a given control byte, x:
 
        x < 0   Absolute value specifies the number of unique words to
                take from the data section (from 1 to 127)
        x = 0   1 word is taken from the control section which specifies
                the number of times to repeat the next data word (from
                128 to 32767)
        x = 1   1 word is taken from the control section which specifies
                the number of unique words to be taken from the data
                section (from 128 - 32767)
        x > 1   Specifies the number of times to repeat the next word
                taken from the data section (from 2 to 127)
 
Format of expanded data:
 
   The expanded data is not simply screen memory bitmap data; instead, the
data is divided into four sets of vertical columns.  (This results in
better compression.)  A column consists of one specific word taken
from each scan line, going from top to bottom.  For example, column 1
consists of word 1 on scanline 1 followed by word 1 on scanline 2, etc.,
followed by word 1 on scanline 200.
   The columns appear in the following order:
 
   1st set contains columns 1, 5,  9, 13, ..., 69, 73, 77 in order
   2nd set contains columns 2, 6, 10, 14, ..., 70, 74, 78 in order
   3rd set contains columns 3, 7, 11, 15, ..., 71, 75, 79 in order
   4th set contains columns 4, 8, 12, 16, ..., 72, 76, 80 in order
 
Note that Tiny partitions the screen this way regardless of resolution; i.e.,
these aren't bitplanes.  For example, medium resoltion only has two bitplanes,
but Tiny still divides medium resolution pictures into four parts.
 
 
<Spectrum 512>  *.SPU
 
80 words        first scan line of picture (unused) -- should be zeroes
15920 words     picture data (screen memory) for scan lines 1 through 199
9552 words      3 palettes for each scan line (the top scan line is
                not included because Spectrum 512 can't display it)
-----------
51104 bytes     total
 
 
<Spectrum 512 (Compressed)>        *.SPC
 
1 word          5350 (hex) ("SP")
1 word          0 (reserved for future use)
1 long          length of data bit map
1 long          length of color bit map
<= 32092 bytes  compressed data bit map
<= 17910 bytes  compressed color bit map
--------------
< 50014 bytes   total
 
Data compression:
 
   Compression is via a modified run length encoding (RLE) scheme,
similar to DEGAS compressed and Tiny.  The data map is stored as a
sequence of records.  Each record consists of a header byte followed by
one or more data bytes.  The meaning of the header byte is as follows:
 
        For a given header byte, x:
 
        0 <= x < 127    Use the next x + 1 bytes literally (no repetition)
        -128 <= x < 0   Use the next byte -x + 2 times
 
The data appears in the following order:
 
        1. Picture data, bit plane 0, scan lines 1 - 199
        2. Picture data, bit plane 1, scan lines 1 - 199
        3. Picture data, bit plane 2, scan lines 1 - 199
        4. Picture data, bit plane 3, scan lines 1 - 199
 
Decompression of data ends when 31840 data bytes have been used.
 
Color map compression:
 
   Each 16-word palette is compressed separately.  There are three
palettes for each scan line (597 total).  The color map is stored as a
sequence of records.  Each record starts with a 1-word bit vector which
specifies which of the 16 palette entries are included in the data
following the bit vector (1 = included, 0 = not included; i.e., stays
the same).  The least significant bit of the bit vector refers to
palette entry zero, while the most significant bit refers to palette
entry 15.  Bit 15 must be zero, since Spectrum 512 does not use palette
entry 15.  Bit 0 should also be zero, since Spectrum 512 always makes the
background color black.
   The words specifying the values for the palette entries indicated in
the bit vector follow the bit vector itself, in order (0 - 15).
   Yes, it is hideously complex.
 
 
<Art Director>  *.ART (low resolution only)
 
16000 words     picture data (screen memory)
16 words        palette
15 * 16 words   15 more palettes for animation
-------------
32512 bytes     total
 
 
<C.O.L.R. Object Editor Mural>        *.MUR (low resolution only)
 
16000 words     picture data (screen memory)
                (palettes are stored in separate files)
-----------
32000 bytes     total
 
 
<Doodle>        *.DOO (high resolution only)
 
16000 words     picture data (screen memory)
-----------
32000 bytes     total
 
 
<Animatic Film> *.FLM (low resolution only)
 
1 word          number of frames
16 words        palette
1 word          speed (0 - 99; value is 99 - # vblanks to delay between frames)
1 word          direction (0 = forwards, 1 = backwards)
1 word          end action (what to do after the last frame)
                0 = pause, then repeat from beginning
                1 = immediately repeat from beginning
                2 = reverse (change direction)
1 word          width of film in pixels
1 word          height of film in pixels
1 word          Animatic version number (major)
1 word          Animatic version number (minor)
1 long          magic number 27182818 (hex)
3 longs         reserved for expansion (should be all zeros)
--------
32 words        total for header
 
? words         image data (words of screen memory) for each frame, in order
 
 
<GEM Bit Image> *.IMG
 
2 words         upper left x,y of bit image
2 words         lower right x,y of bit image
1 word          device page width
1 word          device page height
1 word          device pixel width in microns
1 word          device pixel height in microns
1 word          NBITSPPXL, (bits per pixel, planes, for color information)
7 words         reserved (0)
--------
32 bytes        total for header
 
? bytes         data
 
Format of data
 
Run-length packet:
  +0      [1]  run length   (1..127)
  +1      [1]  color index  (1..255)
 
Extended packet:
  +0      [1]  -1 (opcode, $FF)
  +1      [1]  extended run length (i.e. *128 pixels)
  +2      [1]  color index
 
Raster packet:
  +0      [1]  -2 (opcode, $FE)
  +1      [1]  NPXL, # of pixels in stream
  +2      [..] packed color indices [NPXL*NBITSPPXL bits]
 
Raster-run packet:
  +0      [1]  ? (opcode)
  +1      [1]  pattern repeat count
  +2      [1]  NPXL, # of pixels in stream
  +3      [..] packed color indices
 
 
<Image>         *.IMG
 
1 word          version number of image file
1 word          length of header in words [8]
1 word          number of color planes
1 word          pattern length in bytes [2]
1 word          pixel width in 1/1000 mm
1 word          pixel height in 1/1000 mm
1 word          line width in pixels
1 word          number of lines
-------
16 bytes        total for header
 
? bytes         data
 
For each byte x in the data section,
 
        x = 0           Pattern/scanline run.
                        Read the next byte, n (unsigned).
 
                        If n > 0 then:
                                Read a number of bytes equal to the "pattern
                                length" word in the header.  Repeat this
                                pattern n times.
 
                        If n = 0 then:
                                Scanline run.  Data for the next scanline
                                is to be used multiple times.  Read the
                                following record:
 
                                1 word          unused (?) [255]
                                1 word          number of times to use
                                                next scanline data
 
                                The data for the next scanline follows,
                                compressed normally.
 
        x = 80 (hex)    Uncompressed bit string.  The next byte
                        determines the number of bytes (?) to use
                        literally.  The literal data bytes follow.
 
        otherwise       Monochrome run.  The value of x determines
                        what to draw.  The high bit specifies the color.
                        The low 7 bits, taken as an unsigned quantity,
                        specify the length of the run (the number
                        of pixels to draw).
 
 
<STAD>          *.PAC (high resolution only)
 
4 bytes         "pM86" (vertically packed) or "pM85" (horizontally packed)
1 byte          id byte
1 byte          pack byte (most frequently occuring byte in bitmap)
1 byte          "special" byte
-------
7 bytes         total for header
 
? bytes         data
 
The data is encoded as follows.  For each byte x in the data section:
 
        x = id byte             Read one more byte, n.  Use pack byte
                                n + 1 times.
        x = "special" byte      Read two more bytes, d, and n (in order).
                                Use byte d n times.
        otherwise               Use byte x literally.
 
 
<Imagic Film/Picture>           *.IC1 (low resolution)
                                *.IC2 (medium resolution)
                                *.IC3 (high resolution)
 
4 bytes         "IMDC"
1 word          resolution (0 = low res, 1 = medium res, 2 = high res)
16 words        palette
1 word          date (GEMDOS format)
1 word          time (GEMDOS format)
8 bytes         name of base picture file (for delta compression), or zeroes
1 word          length of data (?)
1 long          registration number
8 bytes         reserved
1 byte          compressed? (0 = no, 1 = yes)
 
If compressed ?
1 byte          delta-compressed? (-1 = no, > -1 = yes)
1 byte          ?
1 byte          escape byte
?
-------
65 bytes        total for header (68 bytes if compressed)
 
? bytes         data
 
   Compressed data may be either stand-alone or delta-compressed (relative
to the base picture named in the header).  Delta compression involves
storing only how the picture differs from the base picture (i.e., only
portions of the screen that have changed are stored).  This is used to
to encode animated sequences efficiently.
 
Compressed data, stand-alone:
 
For each byte x in the data section:
 
        x = escape byte         Read one more byte, n.  (n is unsigned).
 
                                If n >= 2, use the next byte n times.
                                If n = 1, keep reading bytes until a
                                byte k not equal to 1 is encountered.
                                Then read the next byte d.
                                If the number of 1 bytes encountered is o,
                                use d (256 * o + k) times.  I.e.,
 
                                if (n == 1) ?
                                        o = 0;
                                        while (n == 1) ?
                                                o++;
                                                n = next byte;
                                        ?
 
                                        k = n;
                                        d = next byte;
 
                                        Use d (256 * o + k) times.
                                ?
                                else ?
                                        d = next byte;
                                        Use d (n) times.
                                ?
 
        x != escape byte        Use x literally.
 
Compressed data, delta compressed:
 
For each byte x in the data section:
 
        x = escape byte         Read one more byte, n.  (n is unsigned).
 
                                If n >= 3, use the next byte n times.
                                If n = 1, do the same as for n = 1 in
                                stand-alone compression (above).
                                If n = 2, then set n = next byte.
                                        If n = 0, end of picture.
                                        If n >= 2, take n bytes from base
                                        picture.
                                        If n = 1, do the same as for n = 1
                                        in stand-alone compression (above),
                                        but take (256 * o + k) bytes from
                                        base picture.
 
        x != escape byte        Use x literally.
 
 
<IFF Format>    *.IFF
 
4 bytes         "FORM"
8 bytes         form chunk: 1 long = length (8)
                            4 bytes = ID ("ILBM")
4 bytes         "BMHD"
20 bytes        BMHD chunk: 1 long = length (20)
                (BitMap     1 word = x width (pixel)
                 HeaDer)    1 word = y height (pixel)
                            1 word = x-offset (pixel)
                            1 word = y-offset (pixel)
                            1 byte = # bitplanes
                            1 byte = mask (0=no, 1=impl., 2=transparent,
                                           3=lasso)
                            1 byte = compressed (1) or expanded (0)
                            1 byte = 0
                            1 word = transparent color (for mask=2)
                            1 byte = x-aspect
                            1 byte = y-aspect
                            1 word = page width
                            1 word = page height
4 bytes         "CMAP"
3n+8 bytes      CMAP chunk: 1 long = length (3n + 8 for n colors)
                (Color      3 words = R,G,B color 0
                   MAP)     ...
                            3 words = R,G,B color n
4 bytes         "CRNG"
8 bytes                CRNG chunk: 1 long = length (8)
                (Color      1 word = 0
                 RaNGe)     1 word = animation speed
                            1 word = active (1) or inactive (0)
4 bytes         "BODY"
? bytes                body chunk: picture expanded/compressed
 
Format of body data
 
An expanded picture is simply a bitmap.  The compressed data consists
of records of single control bytes followed by data.
 
        For a given control byte, x:
 
        0 <= x <= 127   Use the next x + 1 bytes literally (no repetition)
        -128 <= x <= -1 Use the next byte -x + 1 times
 
The (decompressed) body data appears in the following order:
 
        line 1 plane 0 ... line 1 plane 1 ... ... line 1 plane m
        [line 1 mask (if appropriate)]
        line 2 plane 0 ... line 2 plane 1 ... ... line 2 plane m
        [line 2 mask (if appropriate)]
        ...
        line x plane 0 ... line x plane 1 ... ... line x plane m
        [line x mask (if appropriate)]
 
The FORM chunk identifies the type of data:
 
        "ILBM" = interleaved bit map
        "8SVX" = 8-bit sample voice
        "SMUS" = simple music score
        "FTXT" = formatted text (Amiga)
 
Note:
The R,G,B ranges of AMIGA and ST are different (AMIGA 0...15, ST 0...7),
as is the maximum number of bitplanes (AMIGA: 5, ST: 4).
 
Animation speed of 16384 means 1 full rotation in 1/60's of a second.
 
 
<MacPaint>
 
   Word has it that this is wrong.  Someone please send me an accurate
description!
 
header ?
1 long          version number (if zero, entire header is ignored)
38 * 2 longs    pattern data (anyone know how to use this?)
83 longs        reserved
?                            (total 160 longwords for header)
< 51200 bytes   compressed bitmap data
-------------
< 51716 bytes   total
 
Bitmap compression:
 
   The bitmap data is for a 576 pixel by 720 pixel monochrome image.
The data is stored as a sequence of records.  Each record consists of a
control byte followed by one or more data bytes.  The meaning of the
control byte is as follows:
 
        For a given control byte, x:
 
        0 < x < 127     Use the next x + 1 bytes literally (no repetition)
        -128 <= x <= 0  Use the next byte -x + 1 times
 
There are 72 bytes per scan line.  Each bit represents one pixel; 0 = white,
1 = black.
 
-------------------------------------------------------------------------
 
* Roland Waldi contributed extensive information on the following formats:
 
        GEM, IMG, Doodle, STAD, Imagic Film/Picture, Art Director, IFF
 
 
Version of Sat Dec 30 19:34:48 EST 1989
 
 
------------------------------
 
End of INFO-ATARI16 Digest V89 Issue #2
***************************************
