PIC file format

This document provides an overview of the Softimage® 3D Picture File Format. This format has been used by Softimage 3D and many other application programs for storing true color image data.

The format consists of two parts: file header and image data. The header contains general information about image and specification for each channel. The image data records pixel values.

Table of contents

File Header

The file header can be divided into two sections:

  • Picture info section
  • Channel info section

Picture Info Section

This section contains general information about the picture. It is summarized by the following table.

Offset Length (in bytes) Name Description
0 4 magic A predefined magic number: BINARY_MAGIC_NUMBER. It is 5380f634 (in hex.).
4 4 version Version of format (float).
8 80 comment Prototype description
88 4 id "PICT"
92 2 width image width, in pixels
94 2 height image height, in pixels
96 4 ratio Pixel aspect ratio. Corresponds to pixel width / height. In the case of square pixel, this ratio is 1.
100 2 fields Indicates the picture field type (depending on the manner of using video scanline).
102 2 pad Unused. Should be zero.

The fields field can take one of following codes:

Code Value Description
NO_FIELD 0 No picture
ODD_FIELD 1 Odd scanline
EVEN_FIELD 2 Even scanline
FULL_FRAME 3 Every scanline

Channel Info Section

This section contains one or more "channel packet". Each one describes one or several channels. For instance, we can use a channel packet to describe the Red, Green, Blue channels, and another one to describe Alpha channel. The format of the channel packet is shown in the following table.

Offset Length Name Description
104 1 chained 0 if last packet 1 if there is another packet after this one.
105 1 size Number of bits for each pixel value by channel. Set to 8.
106 1 type Data and encoding type.
107 1 channel Channel code

Encoding Type Codes

Code Value Description
UNCOMPRESSED 0x00 Image is uncompressed
MIXED_RUN_LENGTH 0x02 Run Length compression

Channel Codes

Code Value Description
RED_CHANNEL 0x80 Red channel
GREEN_CHANNEL 0x40 Green channel
BLUE_CHANNEL 0x20 Blue channel
ALPHA_CHANNEL 0x10 Alpha channel

In the Softimage 3D standard picture file, we use one or two of the following packets depending on whether or not there is an alpha channel.

chained = 1 (or 0, if only one packet is used)
size = 8

chained = 0
size = 8

The first packet is for three colors channels, the second, for alpha channel. So the order for encoding each data is:

  • First, data for three colors are encoded together.
  • Then, the alpha channel data are encoded.

Image is compressed. 8 bits for each pixel value by channel. So the pixel value has a range of [0, 255].

Image Data

The image data are stored by scanline, from top to bottom, and from left to right. The order for encoding each channel data is determined in channel packets. For example, when using the two packets of section 1.2, for a 3x3 (width x height) RGBA image, the data are formatted like this:

  • (line 0) RGBRGBRGBAAA
  • (line 1) RGBRGBRGBAAA
  • (line 2) RGBRGBRGBAAA

There are two ways to encode data:

  • Uncompressed
  • Mixed Run Length Compression

Uncompress Data

Data are actual pixel values.

Mixed Run Length Compressed Data

Two cases are considered:

  • Sequences of repeated values (such as "aaaaa").
  • Sequences of non-repeated values (such as "abcde").

A sequence of repeated values is denoted by one or two counts (depending on sequence length) and a single value.

If length < 128, a one byte count is used.

count = length + 127

For example:

aaaaa:	132,a

This page was last modified 03:54, 13 Dec 2010.
This page has been accessed 8487 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy