| Crates.io | wow-blp |
| lib.rs | wow-blp |
| version | 0.3.2 |
| created_at | 2025-06-14 01:36:43.261601+00 |
| updated_at | 2025-08-29 03:59:30.358063+00 |
| description | Parser and encoder for World of Warcraft BLP texture files with DXT compression support |
| homepage | https://github.com/wowemulation-dev/warcraft-rs |
| repository | https://github.com/wowemulation-dev/warcraft-rs |
| max_upload_size | |
| id | 1712022 |
| size | 198,798 |
Parser and encoder for Blizzard BLP texture files used in Warcraft III and World of Warcraft.
✅ Implemented - Full BLP parsing and encoding functionality.
Add to your Cargo.toml:
[dependencies]
wow-blp = "0.3.0"
Or use cargo add:
cargo add wow-blp
use wow_blp::{parser::load_blp, convert::blp_to_image};
// Load BLP file
let blp_file = load_blp("texture.blp")?;
// Convert to standard image format
let image = blp_to_image(&blp_file, 0)?; // mipmap level 0
// Save as PNG
image.save("texture.png")?;
# Ok::<(), Box<dyn std::error::Error>>(())
use wow_blp::{
convert::{image_to_blp, BlpTarget, Blp2Format, DxtAlgorithm},
encode::save_blp,
};
use image::imageops::FilterType;
// Load source image
let image = image::open("input.png")?;
// Convert to BLP2 with DXT5 compression
let blp = image_to_blp(
image,
true, // generate mipmaps
BlpTarget::Blp2(Blp2Format::Dxt5 {
has_alpha: true,
compress_algorithm: DxtAlgorithm::ClusterFit,
}),
FilterType::Lanczos3
)?;
// Save BLP file
save_blp(&blp, "output.blp")?;
# Ok::<(), Box<dyn std::error::Error>>(())
use wow_blp::convert::{BlpTarget, BlpOldFormat, Blp2Format, AlphaBits, DxtAlgorithm};
// BLP0 (Warcraft III Beta) - External mipmaps
let blp0 = BlpTarget::Blp0(BlpOldFormat::Jpeg { has_alpha: true });
// BLP1 (Warcraft III) - Palettized
let blp1 = BlpTarget::Blp1(BlpOldFormat::Raw1 {
alpha_bits: AlphaBits::Bit8
});
// BLP2 (World of Warcraft) - DXT compression
let blp2_dxt = BlpTarget::Blp2(Blp2Format::Dxt5 {
has_alpha: true,
compress_algorithm: DxtAlgorithm::ClusterFit
});
// BLP2 - Uncompressed
let blp2_raw = BlpTarget::Blp2(Blp2Format::Raw3);
use wow_blp::{parser::load_blp, convert::blp_to_image};
// Load BLP file first
let blp_file = load_blp("texture.blp")?;
// Access specific mipmap level
let mipmap_2 = blp_to_image(&blp_file, 2)?;
// 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::<(), Box<dyn std::error::Error>>(())
See the examples directory for more usage examples:
load.rs - Load and convert BLP to PNGsave.rs - Convert PNG to BLPLicensed under either of
at your option.
Based on the image-blp crate by zloy_tulen.