Copied from http://www.itsmods.com/forum/Thread-Help-IWI-Header.html
IWI (Infinity Ward Image) File Format
Length | Position  | Description
---------------------------------
0x3    | 0x0       | Contains the text 'IWi' in ASCII form
0x1    | 0x3       | The version of the IWI 0x5 = COD2, 0x6 = COD4, 0xD = BO (I think), 0x8 = MW2/MW3
0x1    | 0x4       | Unknown, not sure.
0x1    | 0x5       | The flags of the data [If (flags & 0x3) == 0x3, this image has mipmaps]
0x1    | 0x6       | The usage flag. [0x0 = Color image, 0x1 = Skybox collection, 0x4 = Normal Map, 0x09 = Skybox collection (w/ alpha)
0x1    | 0x7       | Unknown, not sure.
0x2    | 0x8       | True format. [0x1 = ARGB8, 0x2 = RGB8, 0x3 = ARGB4, 0x4 = A8, 0x7 = JPG, 0xB = DXT1, 0xC = DXT3, 0xD = DXT5] // Credits to Denton Woods
0x2    | 0xA       | The width of the image (in pixels)
0x2    | 0xC       | The height of the image (in pixels)
0x2    | 0xE       | Unknown, not sure.
0x4    | 0x10      | The file size of the of the file (including header)
0x4    | 0x14      | The offset to the texture
0x4    | 0x18      | Offset to the 1st mipmap 
0x4    | 0x1B      | Offset to the 2nd mipmap