BLP Converter

From WoWDev

Windows console program that converts BLP files into standard PNG files and back again.

Author Patrick Cyr
Source included
License GPL

  • About

This program is very similar to Wowimage in capability. The main difference lies in the interface: WOWImage has a drag-and-drop, cross-platform interface, while BLPConverter uses a Windows command line interface which allows it to be incorporated in batch files/scripts. Also, BLPConverter has a few conversion options available to customize its behavior in ambiguous cases.

An important issue to keep in mind is that for a given texture WoW may only be able to properly display BLPs of a given format. Your best bet is always to retain the original format when modifying BLPs.


  • About the -r Option

The trickiest feature of BLPConverter is the -r option. There is a fundamental problem with these conversions which is that BLPs can handle palettized images with full alpha channels, but no common graphics file formats can. PNGs can only do 1-bit alpha on palettized images, hence when trying to convert a palettized, 8-bit image to a PNG by default you get a 1-bit alpha PNG. This default is nice because it preserves the colors, but bad because you lose that extra alpha detail. This is where the -r option comes in: when the -r option is set BLPConverter will create RGBA PNGs out of palettized, 8-bit BLPs. This conversion is totally lossless, but there is a catch: if you try to convert the RGBA PNG back to a BLP without using the -r option you will wind up with a compressed, non-palettized BLP instead. WoW doesn't necessarily let you feed it any format you want, so you may well end up with junk on the screen. (Also note that the palettization done by BLPConverter can be lossy.) So, the general rule is that if you use the -r option to create a PNG, use it again to remake the BLP.

If the above paragraph was too much, this rule will work 99% of the time: if you are working on clothing textures, always keep the -r option on. Otherwise, leave it off.


  • Usage

Usage: BLPCONVERTER [options] sourceFile [targetFile]

sourceFile: The file to convert. targetFile: Optionally, the name of the converted file. If omitted, target file is given the same name as sourceFile but with the opposite extension.

Options: -p : Pause upon completion. (Handy for drag-and-drop operation.) -g(factor) : (PNG->BLP only) Applies a Gamma factor to the entire image. (factor) is a number between 0.0 and 1.0. If source texture is PNG RGB an alpha channel will be added. -a(value) : Sets the Alpha threshold when converting from palettized, 8-bit BLPs to palettized PNGs. Value is a number between 0 and 255. Source alpha values below the threshold are fully transparent, above are fully opaque. Default is 128. -r : pReserve alpha. The default conversion from palettized, 8-bit alpha BLPs is to palettized 1-bit alpha PNGs, but when this option is set it will create RGBA PNGs instead. Note that while this will preserve alpha, if you convert it directly back it will not create a BLP of the same format unless you use this option again. -m : Multi-file mode. In this mode, multiple files can be input after options. It is not possible to specify custom output names for them in this mode. -i : Info mode. Only outputs information about the file(s) specified. This option automatically sets the -v and -m options. -c : Create mip test image. Outputs an image which contains all of the generated mip levels. -e : pause on Error. -n : No mips. No mip levels will be generated when creating a BLP. Note that the game expects mips in certain circumstances. This was mostly added for making interface textures which don't use mip levels smaller.


  • About BLP Files

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) - Ex. character skins, clothing. Palettized, 1-bit alpha (P1) - Ex. clothing (relatively rare). Palettized, 8-bit alpha (P8) - Ex. clothing.

RGB, 0-bit alpha (RGB0) - Ex. Sansamroot.blp. RGB, 1-bit alpha (RGB1) - Ex. Peaceflower.blp. RGB, 8-bit alpha (RGB8) - Ex. Sungrass.blp.


  • Conversions

BLP -> PNG


BLP P0 -> Palettized PNG. BLP P1 -> Palettized PNG with 1-bit alpha by default. If -r option is specified, RGBA PNG instead. BLP P8 -> Palettized PNG with 1-bit alpha by default. If -r option is specified, RGBA PNG instead. BLP RGB0 -> RGB PNG (Its technically possible for these images to have 1-bit alpha, though have seen no examples.) BLP RGB1 -> RGBA PNG (Full alpha channel, though of course each alpha value is either 0 or 255.) BLP RGB8 -> RGBA PNG

PNG -> BLP


Palettized PNG -> BLP P0 Palettized PNG with 1-bit alpha (Transparency) -> BLP P8 RGB PNG -> BLP RGB0 RGBA PNG -> BLP RGB8 by default. If -r option is specified, BLP P8 instead.


Download