psx.wiki

TIM (Screen Image Data)

Image data that can be transferred directly to VRAM.

TIM (Screen Image Data)
Extension.TIM
ID0x10

This is an old revision of this page, as edited by RemmyLee at 02:27, 23 October 2026. Edit this revision | Latest revision

Overview

The TIM file holds the standard images handled by the PlayStation. It can be transferred directly to VRAM.1

TIM data serves as sprite patterns and as texture material for 3D texture mapping.1

A TIM file holds image data in one of the following modes:

Table 1: TIM image data modes
PMODE Mode Use
0 4-bit CLUT Sprite and texture data
1 8-bit CLUT Sprite and texture data
2 15-bit direct Sprite, texture and display data
3 24-bit direct Display data
4 Mixed Several kinds of data in one file

VRAM is organized in 16-bit units. Only 16-bit and 24-bit data can be transferred to the frame buffer for display.1

Sprite and texture data can use any mode except 24-bit direct.1

File Structure

A TIM file starts with a file header (ID). The FLAG, CLUT and pixel data blocks follow.1

Each item is a string of 32-bit words.1

The data is little endian. The lowest byte of a word holds the lowest address.1

The blocks are as follows:

Table 2: TIM file blocks
Block Contents
ID File ID and version number
FLAG Pixel mode and CLUT flag
CLUT Color lookup tables (only when CF is 1)
Pixel Image data

ID

The ID is one word.1

Table 3: TIM file header
Bits Field Value
0..7 ID 0x10
8..15 Version No. 0x00
16..31 Reserved All zero

Flag

The flag word holds information about the file structure.2

Table 4: TIM flag word
Bits Field Contents
0..3 PMODE Pixel mode: 0 4-bit CLUT, 1 8-bit CLUT, 2 15-bit direct, 3 24-bit direct, 4 mixed
4 CF 0 no CLUT section, 1 has CLUT section
5..31 Reserved All zero

A TIM file that holds several sprites and textures of different types has a PMODE of 4.2

CLUT

A CLUT is a color palette. Image data in 4-bit and 8-bit mode uses it.2

The CLUT block opens with its length in bytes. Its frame buffer position, its size and the CLUT entries follow.2

The CLUT block has the following fields:

Table 5: CLUT block
Field Contents
bnum Data length of the CLUT block in bytes, including the 4 bytes of bnum
DX X coordinate in the frame buffer
DY Y coordinate in the frame buffer
W Size of the data in the horizontal direction
H Size of the data in the vertical direction
CLUT 1..n CLUT entries, 16 bits each

In 4-bit mode one CLUT has 16 entries. In 8-bit mode one CLUT has 256 entries.3

CLUTs are located in the frame buffer. The CLUT block is handled as a rectangular frame buffer image, one entry per pixel.3

A 4-bit CLUT is an image 16 wide and 1 high. An 8-bit CLUT is an image 256 wide and 1 high.3

One TIM file can hold several CLUTs. They are combined into one image in the CLUT block.3

CLUT Entry

One CLUT entry is one color.3

Table 6: CLUT entry
Bits Field Contents
0..4 R Red component (5 bits)
5..9 G Green component (5 bits)
10..14 B Blue component (5 bits)
15 STP Transparency control bit

STP is valid when the data is used as sprite or texture data. It sets whether the pixel is transparent.3

The STP bit and the color combine as follows:

Table 7: STP bit function with R G B data
STP/R,G,B Translucent processing on Translucent processing off
0/0,0,0 Transparent Transparent
0/X,X,X Not transparent Not transparent
1/X,X,X Semi-transparent Not transparent
1/0,0,0 Non-transparent black Non-transparent black

Pixel Data

Pixel data is the image itself. The frame buffer has a 16-bit structure, so the image data is divided into 16-bit units.3

The pixel data block has the following fields:

Table 8: Pixel data block
Field Contents
bnum Data length of the pixel data in bytes, including the 4 bytes of bnum
DX Frame buffer x coordinate
DY Frame buffer y coordinate
W Size of the data in the horizontal direction, in 16-bit units
H Size of the data in the vertical direction
DATA 1..n Frame buffer data, 16 bits each

W counts 16-bit units. In 4-bit mode it is 1/4 of the image width, and in 8-bit mode it is 1/2.4

The width of a 4-bit image must be a multiple of 4. The width of an 8-bit image must be an even number.4

Frame Buffer Data

The layout of one 16-bit item depends on the image data mode.4

Each mode uses the following layout:

Table 9: Frame buffer data by mode
Mode Contents of one 16-bit item
4-bit pix0 in bits 0..3, pix1 in bits 4..7, pix2 in bits 8..11, pix3 in bits 12..15 (CLUT numbers)
8-bit pix0 in the low byte, pix1 in the high byte (CLUT numbers)
16-bit R in bits 0..4, G in bits 5..9, B in bits 10..14, STP in bit 15
24-bit 3 items hold 2 pixels

Pixels appear on the screen in order from the LSB side.4

In 24-bit mode three 16-bit items hold two pixels:5

Table 10: 24-bit pixel pair
Item Bits 8..15 Bits 0..7
0 G0 R0
1 R1 B0
2 B1 G1

R0, G0 and B0 are the left pixel. R1, G1 and B1 are the right pixel.5

References


  1. ^ a b c d e f g h Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-3.

  2. ^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-4.

  3. ^ a b c d e f g Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-5, Table 3-1.

  4. ^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-6, Figure 157.

  5. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-7.

Categories: File formats