Tim
De Wiki Tales Translations
TIM Graphics Format
Header
Name Size Description Header 8 Bytes
Signature 4 Bytes 0x10 0x00 0x00 0x00 BPP Mode 1 Byte This tells what bit mode the graphics is in. 0x08 signifies 4bpp, 0x09 signifies 8bpp, 0x02 signifies 16 bpp, and 0x03 signifies 24 bpp mode. Reserved 3 Bytes 0x00 0x00 0x00
Palette Info 12+ Bytes Only present for bit modes less than 16.
Length of the CLUT Data 4 Bytes This is the length of the CLUT Data + 12 (accounting for 12 bytes before the CLUT Data starts).
It should equal: Number of Colors in CLUT * Number of CLUTs * 2 + 0xC
Palette Org X 2 Bytes X coordinate in frame buffer. Palette Org Y 2 Bytes Y coordinate in frame buffer. Number of Colors in CLUT 2 Bytes Depends on the BPP Mode. The value for 4 bpp is 16, and for 8 bpp is 256. Number of CLUTs 2 Bytes This is the number of CLUT groupings. CLUT Data Number of CLUTs * Number of Colors in CLUT * 2
Image Info 12+ Bytes Present for all modes.
Length of the Image Data 4 Bytes This is the length of the Image Data + 12 (accounting for 12 bytes before Image Data starts).
It should equal: Image Width * 2 * Image Height + 0xC
Image Org X 2 Bytes Frame buffer X coordinate. Image Org Y 2 Bytes Frame buffer Y coordinate. Image Width 2 Bytes * See below Image Height 2 Bytes This is the height of the image in pixels. Image Data Varies Contains data on all the pixels in the image.
- Note: To get the actual Width, you must multiply the number by either 4 in 4bpp, 2 in 8bpp, 1 in 16bpp, or 1.5 in 24bpp mode to get it in terms of Pixels.
CLUTs
Each CLUT entry is 2 Bytes and all the colors are stored in the order TBGR (Transparency, Blue, Green, and Red). The Transparency bit is only 1 bit, while the others are 5 bits each.
Note: For the CLUT Date in 4bpp, there are 16 Colors per CLUT, 32 bytes per CLUT. In 8bpp, there are 256 Colors per CLUT, 512 bytes per CLUT.
Actual Image Data
4 bpp mode: Each byte contains 2 pixels (4 bits per pixel). Each 4 bits is a numeric refernce to the CLUT Data. 8 bpp mode: Each byte contains 1 pixel (8 bits per pixel). Each byte is a numeric refernce to the CLUT Data. 16 bpp mode: Each 2 bytes contain 1 pixel (16 bits per pixel) which is in the same format as the CLUT itself. 24 bpp mode: Each 3 bytes contain 1 pixel (24 bytes per pixel). It is the same as the CLUT except each color is 1 byte instead of 5 bits.

