wow-blp
Parser and encoder for Blizzard BLP texture files used in Warcraft III and World of Warcraft.
Status
✅ Implemented - Full BLP parsing and encoding functionality.
Features
- Parse and encode all BLP versions (BLP0, BLP1, BLP2)
- Support for all compression formats:
- JPEG compression with alpha channel
- RAW1 (256-color palettized) with 0/1/4/8-bit alpha
- RAW3 (uncompressed BGRA)
- DXT1/3/5 compression (S3TC)
- Mipmap support (internal and external)
- Convert between BLP and standard image formats
- High-performance DXT compression using texpresso
Supported Versions
- BLP0 - Warcraft III Beta (external mipmaps)
- BLP1 - Warcraft III (1.x+)
- BLP2 - World of Warcraft (all versions)
- Classic (1.12.1)
- The Burning Crusade (2.4.3)
- Wrath of the Lich King (3.3.5a)
- Cataclysm (4.3.4)
- Mists of Pandaria (5.4.8)
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Or use cargo add:
Usage
Loading BLP Files
use ;
// Load BLP file
let blp_file = load_blp?;
// Convert to standard image format
let image = blp_to_image?; // mipmap level 0
// Save as PNG
image.save?;
# Ok::
Creating BLP Files
use ;
use FilterType;
// Load source image
let image = open?;
// Convert to BLP2 with DXT5 compression
let blp = image_to_blp?;
// Save BLP file
save_blp?;
# Ok::
Format Options
use ;
// BLP0 (Warcraft III Beta) - External mipmaps
let blp0 = Blp0;
// BLP1 (Warcraft III) - Palettized
let blp1 = Blp1;
// BLP2 (World of Warcraft) - DXT compression
let blp2_dxt = Blp2;
// BLP2 - Uncompressed
let blp2_raw = Blp2;
Working with Mipmaps
use ;
// Load BLP file first
let blp_file = load_blp?;
// Access specific mipmap level
let mipmap_2 = blp_to_image?;
// Get mipmap count
let count = blp_file.header.mipmaps_count;
// For BLP0, external mipmap files are handled automatically
// texture.blp → texture.b00, texture.b01, etc.
# Ok::
Examples
See the examples directory for more usage examples:
load.rs- Load and convert BLP to PNGsave.rs- Convert PNG to BLP
Performance
- DXT compression/decompression is parallelized using rayon
- Direct GPU upload support for DXT formats
- Efficient palette quantization for RAW1 format
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Credits
Based on the image-blp crate by zloy_tulen.