FF7/TEX format
From Final Fantasy Inside
< FF7
TEX Texture Data Format for PC by Mirex
FF7 PC texture consists of header, an optional palette and bitmap data. Usually data are stored like palletized picture, with bitmap pixels referencing to palette. Color 0 (in palette its usually black) is usually used as transparent color.
When bit depth is 16 then data are stored as packed RGB in style RGB555, which means 5 bits per color in one 2 byte entry. I'm not sure if it is used in FF7 at all, its probably used in FF8.
Offset | Size | Description |
---|---|---|
|
||
0x00 | 56 bytes | Unknown |
0x38 | 4 bytes (long) | bit depth - can be 4, 8, 16 |
0x3c | 4 bytes (long) | Image Width |
0x40 | 4 bytes (long) | Image Height |
0x44 | 20 bytes | Unknown |
0x58 | 4 bytes (long) | Number of Palette Entries |
0x5c | 144 bytes | Unknown |
0xec | Palette Entries * 4 | Every 4 bytes from palette represent one color, BGRA -Blue Green Red Alpha, but I'm not sure about the alpha byte. I'm using only the BGR part |
Pixel data are present after the Palette data | ||
Varies | (sizex * sizey) if bit depth is 4 or 8, (sizex * sizey * 2) if bit depth is 16 |
The bitmap: If bit depth is 4 or 8, every byte of bitmap data is reference to palette color. If bit depth is 16, bitmap is composed from 16bit (2byte, short) values, which are RGB555 colors. |