World of Warcraft / Warcraft 3 bitmaps - solved

All questions and discussions about file format analysis are welcome in this forum.

Moderators: Alhexx, mirex

World of Warcraft / Warcraft 3 bitmaps - solved

Postby mirex » Sat Oct 15, 2005 16:23

I'm also looking for some information about BLP 2 texture files of the WoW game. Any around ? Also 3D file description would be nice :)

I will probably have some info about BLP soon, because I have W3 BLP description here:
and I got tips to look into the files:
Last edited by mirex on Sun Aug 13, 2006 16:53, edited 3 times in total.
User avatar
Posts: 119
Joined: Sat Oct 15, 2005 11:20
Location: SVK

Postby mirex » Sun Oct 23, 2005 11:22

Thanks to some descriptions on the net and thanks to some sourcecode found on the links above its all figured out.

--- BLP used in W3 ---

I found quite good description by BlacKDlcK, so I'll paste that, although I have some comments:

************************************************************************ *
* by BlacKDlcK *
************************************************************************ *

The *.blp files are 2D picture files used on Blizzard Entertainment Games.
I guess 'blp' stands for "Blizzard Picture". Their main usage is TEXTUREs.
They suport different mip-maps (up to 16).

Those are used on the following Blizzard games:
1) "Warcraft III Reign of Chaos BETA"
2) "Warcraft III Reign of Chaos" (the retail and the demo version)
3) "Frozen Throne BETA"

Some important things:
a) "Warcraft III Reign of Chaos BETA" uses the first version of blp files, also
known as "BLP0".
b) All other games (for now) are using the "BLP1" version.
c) On "Warcraft III Reign of Chaos", they use both JPG-BLPs and Palleted-BLPs.
The JPG-BLPs DO NOT get goo compression on Blizzard archive format, "MPQs" since JPEGs are already "huffman compressed".
d) On "Frozen Throne BETA" they are only using Palleted-BLPs, since those get better compression on the "MPQs". They´re also using TGA´s (dunno why).

************************************************************************ *
************************************************************************ *
Signature As String * 4 'BLP0 or BLP1
ImageType As Long '0 for JPGblp, 1 for Paletted
hasAlpha As Long '0x8 = has alpha, 0x0 = no alpha
Width As Long 'Image Width
Height As Long 'Image Height
hasTeamColor As Long 'Got values of 3,4,5 here. If use >=5 on 'unit' textures, it won't show the team color.
isValid As Long 'Always =>0x1, if 0x0 the model that uses this texture will be messy.

************************************************************************ *
* MIPMAPTABLE (Only present if the file is a BLP1 *
************************************************************************ *
MipmapOffset(15) As Long <- my opinion is that there are 16 of both, not 15
MipMapSize(15) As Long

************************************************************************ *
* GENERAL DATA (shared by all mip-maps) *
************************************************************************ *
If it is a JPEG-Blp we get:
JPEGHeaderSize as Long 'The lenght of the JPEGHeaderData.
JPEGHeaderData() as Byte 'The JPEGHeaderData.

If it is a Paletted-Blp, we get:
Palette(255) as RGBA 'RGBA is 4 bytes

************************************************************************ *
************************************************************************ *
If this is a BLP0 file, then we must open a separate mipmap file (*.bxx), where 'xx'
is the mip-map level data. The lenght of the mip-map data is the len of the mip-map
file. For an example, to use a "Level 1" mipmap, the file name would be:
'name of blp file without .blp' + '.b01'

If this is a BLP1 file, then we can grab each mip-map data checking the table above.
Go to the MipMapOffset and read MipMapSize bytes.

Small tip:
Dont ask me why, but on BLP1 files Blizzard added some extra padding bytes between
the JPEGHeader and the first Mip-Map data. Those bytes can be safelly
erased if you fix each MipMappoffset entry on MipMapTable (subtract the ammount of
erased bytes).

************************************************************************ *
* Reading the mip-map data *
************************************************************************ *
If it is a JPEG-blp, we need to decompress the mipmap to get a RGBA picture.
Get the JPEGHeaderData + MipMapData and you'll have a JPEG-JFIF file.

If it is a Palleted-blp, we will have 2 bytes for each pixel of the picture:
ImageIndex as byte
AlphaIndex as byte

The ImageIndex reffer to the pallete.
The AlphaIndex reffer to a standard grayscale pallete.

^ in my opinion this 'one byte image index, one byte alpha index' is nonsense.
Paletted images I encouteres had only continuous array of image bytes, no alpha bytes.

--- BLP used in WoW ---

Big thanks to Alexander Zaprjagaev ( for his Blp2Tga, which kinda describe the BLP2 format.

Header of BLP2 are same as in BLP1 and BLP0, only difference is that identificator is "BLP2"

Code: Select all
struct s_Blp2Header {
   char         ident[4];
   long         type;
   unsigned char   subtype[4];
   long         sizex, sizey;
   unsigned long   mipmap_offs[16], mipmap_size[16];
} ;

if TYPE = 1 and SUBTYPE[0] = 1 then picture is paletized, it is the same as paletized image in BLP1. Header is followed by 1024 bytes of palette (256xRGBA). Picture data (found at MIPMAP_OFFS) are SIZEX * SIZEY bytes of pixels referring to the palette.
It is also noted that if the SUBTYPE[1] is greater than 1 that the pixel bytes are followed by SIZEX * SIZEY bytes, where each byte defines the ALPHA for pixel of the image. I could not test this because I don't have such image.

if TYPE = 1 and SUBTYPE[0] = 2 then picture is DDS Direct X image.
If SUBTYPE[1] = 8 the data are in DDS_FORMAT_DXT3 else they are in DDS_FORMAT_DXT1. Data at the MIPMAP_OFFS are again pixel data only, without DDS header.

so that's all, according to this I've been able to successfully load all the BLP pictures that went through my hands.

Newest release of Biturn can load and save both BLP and BLP2 images. Saving for BLP2 is supported only for paletted images though.
User avatar
Posts: 119
Joined: Sat Oct 15, 2005 11:20
Location: SVK

Return to File Format Analysis

Who is online

Users browsing this forum: No registered users and 1 guest