summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE24
-rw-r--r--Makefile4
-rw-r--r--README.md71
-rw-r--r--main.c (renamed from blpconvert.c)0
4 files changed, 97 insertions, 2 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..416f708
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+BSD 2-Clause License
+
+Copyright (c) 2025, Mitja Felicijan <mitja.felicijan@gmail.com>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
index 1559e7f..a2bc454 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,2 @@
-blpconvert: blpconvert.c
- clang -o blpconvert blpconvert.c
+blpconvert: main.c
+ cc -o blpconvert main.c
diff --git a/README.md b/README.md
index e69de29..5b3b408 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,71 @@
+# Converts BLP to PNG
+
+This tool converts images in BLP texture file format used in many games such as
+World of Warcraft into PNG files.
+
+It works with DXT1, DXT3 and DXT5 compressions so it should convert anything
+from WoW.
+
+It should work on all operating systems. There is no funky code in this
+repository or or any dependencies you need to have installed on your machine. C
+compiler and Libc is all you need.
+
+## Compile & Use
+
+```sh
+make -B
+```
+
+This will create `blpconvert` binary. Check available options with
+`./blpconvert -h`.
+
+Basic example of usage is `./blpconvert samples/Ability_Ambush.blp`.
+
+You can provide multiple input files or you can also use Bash expansion when
+providing files to the tool.
+
+```sh
+./blpconvert samples/*.blp
+```
+
+## Verbose output
+
+If you provide `-v` flag the program will output a bunch of diagnostical data.
+
+```sh
+$ ./blpconvert samples/Ability_Ambush.blp -v
+Processing File:
+ Fullname: samples/Ability_Ambush.blp
+ Folder: samples
+ Filename: Ability_Ambush
+ Extension: .blp
+BLP File Details:
+ Type: 1, BLP/DXTC/Uncompressed
+ Compression: 2, DXTC
+ Alpha Depth: 8
+ Alpha Type: 1
+ Has Mipmaps: 17
+ Width: 64, Height: 64
+Reading image data at offset 1172, size 4096 bytes
+BLP is compressed with DXTC.
+Image has 4096 bytes.
+Saving decoded image as PNG...
+Successfully saved samples/Ability_Ambush.png
+
+First few pixels of decoded image (RGBA format):
+( 0, 0, 0, 0) ( 0, 0, 0, 0) ( 0, 0, 0, 0) ( 0, 0, 0, 0)
+( 0, 0, 0, 0) ( 0, 0, 0, 0) ( 0, 0, 0, 0) ( 0, 0, 0, 0)
+( 0, 0, 0, 0) ( 0, 0, 0, 0) ( 0, 0, 0, 51) (184,200,200,221)
+( 0, 0, 0, 0) ( 0, 0, 0, 0) (184,200,200,221) (184,200,200,255)
+```
+
+## Reading material
+
+- https://wowwiki-archive.fandom.com/wiki/BLP_file
+- https://en.wikipedia.org/wiki/S3_Texture_Compression
+
+## License
+
+[blpconvert](https://github.com/mitjafelicijan/blpconvert) was written by [Mitja
+Felicijan](https://mitjafelicijan.com) and is released under the BSD
+two-clause license, see the LICENSE file for more information.
diff --git a/blpconvert.c b/main.c
index f4a324f..f4a324f 100644
--- a/blpconvert.c
+++ b/main.c