An Alias pix file has a 10-byte header containing 5 short integers (there is no explicit magic number) which is then followed immediately by image data in a simple run-length encoded scheme.
Only RGB information is contained in the file. Matte files are similar but exist in a separate file (see Matte File Format for details).
bytes | header value | notes |
0, 1 | width | x resolution in pixels |
2, 3 | height | y resolution in pixels |
4, 5 | xoffset | unused |
6, 7 | yoffset | unused |
8, 9 | bits/pixel | 24 for pix files (0x18) |
The pixels are then run-length encoded in 4-byte packets on a per-scanline basis (runs do not extend beyond a single scanline) starting with the top scanline in the image.
bytes | data range | notes |
runlength | 1 - 255 | number of pixels in succession with given RGB |
blue | 0 - 255 | value of blue component |
green | 0 - 255 | value of green component |
red | 0 - 255 | value of red component |
Here is the output of od -x for a pix file that is 8 pixels wide and 6 pixels high, representing a ramp that goes from black at the bottom of the image to blue at the top:
0000000 0008 0006 0000 0005 0018 08ff 0000 08cc 0000020 0000 0899 0000 0866 0000 0833 0000 0800 0000040 0000 0000042
This is read as describing an image that is 8 pixels wide [0008] and 6 scanlines high [0006]. The next four bytes describe the obsolete offset information. This is a pix file since there are 24 bits/pixel [0018]. The first (top) scanline is composed of a run of 8 pixels of (B=255, G=0, R=0)[08ff 0000]. The next scanline (since this one is complete) is 8 pixels of (B=204, G=0, R=0) [08cc 0000]. The rest of the scanlines are coded in the same fashion with the last scanline of eight pixels of (B=0, G=0, R=0) [0800 0000].