Kodi Community Forum

Full Version: xbtfextractor extracts .xbt texture files!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey everyone, good news!

It's long been said that you can't extract images stored in a skin's texture file, but I've found an awesome project on GitHub that does just that. https://github.com/larshall/xbtfextractor

I've only run this on Ubuntu so far, but perhaps some others will have some luck compiling it for other OSs.

Install Instructions:
Code:
sudo apt-get install liblzo2-dev libpng-dev libjpeg-dev libgif-dev git
sudo add-apt-repository ppa:kervala/ryzom
sudo apt-get update
sudo apt-get install libsquish-dev

git clone git://github.com/larshall/xbtfextractor.git
cd xbtfextractor
make
sudo make install

Usage:
Code:
xbtfextractor -c /path/to/skin/media/textures.xbt

This will extract the contents of the texture file to the directory that you are in currently. Check the GitHub page for other optional arguments that can be passed.

There is still an issue with extracting jpg files as it is possible that the colour channels will be BGR and not RGB so your images may look like they are in a very wrong colour. I have a temporary fix for this. Just a quick python script that you can run. You will need to install PIL for python if you do not have it already:

Install PIL:
Code:
sudo easy_install PIL

bgr_rgb.py:
Code:
from PIL import Image
import numpy as np
import sys

sub = Image.open(sys.argv[1])
sub = sub.convert("RGBA")
data = np.array(sub)
red, green, blue, alpha = data.T
data = np.array([blue, green, red, alpha])
data = data.transpose()
sub = Image.fromarray(data)

sub.save(sys.argv[1])

Usage:
Code:
python bgr_rgb.py /path/to/image.jpg

That will cycle the colour channels in the image and make everything look better. Smile

I thought all you skin modders would appreciate this especially. Happy skinning!
The notepad++ plugin from tiben20 can also do this
Ah, good to know. Not sure how I didn't come across that in my earlier searches.

In either case, those of us not on Windows can now also extract texture files.