1# Converts BLP textures to images
 2
 3This tool converts images in BLP texture file format used in many games such as
 4World of Warcraft into PNG files.
 5
 6It works with DXT1, DXT3 and DXT5 compressions so it should convert anything
 7from WoW.
 8
 9> [!NOTE]
10> It should work on all operating systems. There is no funky code in this
11> repository or or any dependencies you need to have installed on your machine.
12> C compiler and Libc is all you need.
13
14## Compile & Use
15
16```sh
17make -B
18```
19
20This will create `blpconvert` binary. Check available options with
21`./blpconvert -h`.
22
23Basic example of usage is `./blpconvert samples/Ability_Ambush.blp`.
24
25You can provide multiple input files or you can also use Bash expansion when
26providing files to the tool.
27
28```sh
29./blpconvert samples/*.blp
30```
31
32Program supports exporting to the following formats:
33
34- PNG
35- BMP
36- JPG
37- TGA
38
39```sh
40./blpconvert -f bmp samples/Ability_Ambush.blp
41```
42
43> [!IMPORTANT]
44> By default it will use PNG but you can see use `-f` flag.
45
46## Verbose output
47
48If you provide `-v` flag the program will output a bunch of diagnostical data.
49
50```sh
51$ ./blpconvert samples/Ability_Ambush.blp -v
52Processing File:
53  Fullname: samples/Ability_Ambush.blp
54  Folder: samples
55  Filename: Ability_Ambush
56  Extension: .blp
57  Format: png
58BLP File Details:
59  Type: 1, BLP/DXTC/Uncompressed
60  Compression: 2, DXTC
61  Alpha Depth: 8
62  Alpha Type: 1
63  Has Mipmaps: 17
64  Width: 64, Height: 64
65Reading image data at offset 1172, size 4096 bytes
66BLP is compressed with DXTC.
67Image has 4096 bytes.
68Saving decoded image as PNG...
69Successfully saved samples/Ability_Ambush.png
70
71First few pixels of decoded image (RGBA format):
72(  0,  0,  0,  0) (  0,  0,  0,  0) (  0,  0,  0,  0) (  0,  0,  0,  0)
73(  0,  0,  0,  0) (  0,  0,  0,  0) (  0,  0,  0,  0) (  0,  0,  0,  0)
74(  0,  0,  0,  0) (  0,  0,  0,  0) (  0,  0,  0, 51) (184,200,200,221)
75(  0,  0,  0,  0) (  0,  0,  0,  0) (184,200,200,221) (184,200,200,255)
76```
77
78## Reading material
79
80- https://wowwiki-archive.fandom.com/wiki/BLP_file
81- https://en.wikipedia.org/wiki/S3_Texture_Compression
82- https://wowdev.wiki/BLP
83
84## Special thanks
85
86- https://github.com/nothings/stb
87
88## License
89
90[blpconvert](https://github.com/mitjafelicijan/blpconvert) was written by [Mitja
91Felicijan](https://mitjafelicijan.com) and is released under the BSD
92two-clause license, see the LICENSE file for more information.