BLP files store textures with precalculated mipmaps. BLP files are capable of storing data with a few different formats. The primary variables are palettized/RGB and alpha bit depth. The RGB formats are actually stored using DXT compression (DXT1 for 0-bit alpha and DXT3 for the others), and thus conversion to these formats is somewhat lossy. Here is a list (with my shorthand for the format in parenthesis):
Palettized, 0-bit alpha (P0) - Example: character skins, clothing.
Palettized, 1-bit alpha (P1) - Example:. clothing (relatively rare).
Palettized, 8-bit alpha (P8) - Example: clothing.
RGB, 0-bit alpha (RGB0) - Example: Sansamroot.blp.
RGB, 1-bit alpha (RGB1) - Example: Peaceflower.blp.
RGB, 8-bit alpha (RGB8) - Example: Sungrass.blp.
Offset Type Description 0x00 char always 'BLP2' 0x04 uint32 Version, always 1 0x08 uint8 Compression: 1 for uncompressed, 2 for DXTC, 3 (cataclysm) for plain A8R8G8B8 textures (see remarks) 0x09 uint8 Alpha channel bit depth: 0, 1 or 8 0x0A uint8 Something about alpha? (compressed, alpha:0 or 1): 0, (compressed, alpha:8): 1, uncompressed: 2,4 or 8 (mostly 8) 0x0B uint8 when 0 there is only 1 mipmaplevel. compressed: 0, 1 or 2, uncompressed: 1 or 2 (mostly 1) 0x0C uint32 X resolution (power of 2) 0x10 uint32 Y resolution (power of 2) 0x14 uint32 offsets for every mipmap level (or 0 when there is no more mipmap level) 0x54 uint32 sizes for every mipmap level (or 0 when there is no more mipmap level)
Alpha channel bit depth = 4 are found in Interface\Glues\Credits\*.blp. Most BLP converters are not compatible with this.
For compressed textures, DXT1 or DXT3 (possibly DXT5 depending on the header values) data follows, for every mipmap level. Unused mipmap levels have an offset and size of 0.
Detailed description of the DXTC formats can be found on MSDN or on Wikipedia (http://en.wikipedia.org/wiki/.BLP)
After the header, 256 32-bit BGRA values make up the palette. The image data (for each mipmap level) consists of 8-bit indices into this palette.
If there is an alpha channel, then transparency data follows the image data in each mipmap level. If the Alpha bit depth is 0, there is no alpha channel. If the Alpha bit depth is 1, the alpha data is 8 alpha bits backed into each byte. If the Alpha big depth is 8, there is one byte per alpha value.
If compression is set to 3 we also have uncompressed textures but they do not use a color palette. They just store the pixels in A8R8G8B8 format. You can read all the pixels and fill them directly into a texture. Examples for such textures are found in: tileset\Terrain Cube Maps\
--Cromon 09:56, 28 February 2012 (UTC)