Kingdom Hearts II - Image
The game engine uses a custom texture format for all the 2D images to render.
IMGD
Contains a single image. The file structure is defined below. Files of this type have .imd
as extension.
FAC
Contains multiple IMGDs aligned by 0x800
and appended one after another. Files of this type have .fac
as extension.
The only known FAC files are used by Jiminy’s journal menu.
IMGZ
Contains multiple IMGDs prepended by a specific header. They are appended one after another without any padding. Files of this type have .imz
as extension.
File structure
IMGD Header
Offset | Type | Description | Comment |
---|---|---|---|
00 | uint32_t | Magic code, always 0x44474D49 |
|
04 | uint32_t | Always 256 |
|
08 | uint32_t | Bitmap offset | |
0c | uint32_t | Bitmap size in bytes | |
10 | uint32_t | Palette offset | |
14 | uint32_t | Palette size in bytes | |
18 | uint32_t | Always -1 |
|
1c | uint16_t | Image width | |
1e | uint16_t | Image height | |
20 | uint16_t | 2 to the power of image width (2ⁿ) | 2⁷ = 128, for example. |
22 | uint16_t | 2 to the power of image height (2ⁿ) | Inversely, to calculate the desired value, run the following calculation (where X is the desired image width/height and n = value): log(X) / log(2) = n |
24 | uint16_t | Image width divided by 64 |
|
26 | uint16_t | Image format | |
28 | uint32_t | Always -1 |
|
2c | uint16_t | 8 when format is 4bpp, else 16 |
|
2e | uint16_t | 2 when format is 4bpp, else 16 |
|
30 | uint32_t | Always 1 |
|
32 | uint16_t | 19 when format is 32bpp, else 0 |
|
34 | uint16_t | 3 if 32bpp, 5 if 8bpp or 4 if 4bpp |
|
36 | uint16_t | 0 when format is 32bpp, else 3 |
|
38 | uint32_t | Always 0 |
|
3c | uint32_t | 7 if the image is swizzled, else 3 |
IMZ header
Offset | Type | Description |
---|---|---|
00 | uint32_t | Magic code, always 0x5A474D49 |
04 | uint32_t | Always 256 |
08 | uint32_t | Header length. Always 16 |
0c | uint32_t | IMGD count |
Image formats
ID | Format |
---|---|
0x00 | 32 bits per pixel |
0x13 | 8 bits per pixel |
0x14 | 4 bits per pixel |