Difference between revisions of "TexturePacker"

From Official Kodi Wiki
Jump to: navigation, search
m
(Usage)
 
(15 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
<section begin="intro" />Kodi uses a tool named TexturePacker to compile all images used in a skin into a single file. The benefit of it is that images inside the Textures.xbt will load faster in the skin. This is done by converting all images into a format that take less processing by Kodi when they need to be rendered onto the screen.
 
<section begin="intro" />Kodi uses a tool named TexturePacker to compile all images used in a skin into a single file. The benefit of it is that images inside the Textures.xbt will load faster in the skin. This is done by converting all images into a format that take less processing by Kodi when they need to be rendered onto the screen.
  
A common misconception is that TexturPacker will just compress the images into a single file, this if far from the truth, so don't be surprised if the Textures.xbt file is much larger than to total size of all the individual images.
+
A common misconception is that TexturPacker will just compress the images into a single file. This if far from the truth, so don't be surprised if the Textures.xbt file is much larger than the total size of all the individual images.
 
<section end="intro" />
 
<section end="intro" />
 
== How To Get It ==
 
== How To Get It ==
 
If you are using Windows, you can simply download a zipfile with an up-to-date version of TexturePacker from the Kodi mirrors.
 
If you are using Windows, you can simply download a zipfile with an up-to-date version of TexturePacker from the Kodi mirrors.
<br />'''It is available here:''' [http://mirrors.xbmc.org/build-deps/win32/texturepacker-1.0.1-win32.7z '''Download TexturePacker 1.0.1''']
+
<br /><big>'''It is available here:''' [http://mirrors.kodi.tv/build-deps/win32/texturepacker-1.1.1-win32.7z '''Download TexturePacker 1.1.1''']</big>
 
{{note| This is a dll free self contained texturepacker executable for windows.}}
 
{{note| This is a dll free self contained texturepacker executable for windows.}}
 +
{{note| Kodi v17 does not support DXT packed textures anymore. Make sure you pack your skin textures with latest texturepacker (1.1.0 or newer).}}
  
On other platforms, you will have to compile TexturePacker yourself. This is done by compiling Kodi and when the compile is finished, you can find TexturePacker inside the ../tools/depends/native/TexturePacker directory.
+
On other platforms, you will have to compile TexturePacker. TexturePacker is built and stored in ../tools/depends/native/TexturePacker/bin during Kodi's configure process.  Bootstrap and configure can be lengthy. If you only need TexturePacker, you can save some effort: install the Kodi source and build dependencies in preparation for a build ([http://kodi.wiki/view/Category:Compiling '''Compiling from source''']) and build TexturePacker directly:
 +
 
 +
<syntaxhighlight lang="bash">
 +
cd xbmc/tools/depends/native/TexturePacker
 +
make
 +
</syntaxhighlight>
 +
 
 +
{{Note| TexturePacker depends on libgif which is currently not a ''Kodi'' dependency.  Ensure the library and its development headers (Debian: libgif-dev package) is installed before compiling.}}
 +
 
 +
One you have downloaded/build TexturePacker, copy it to the kodi addons folder.
  
 
== Usage ==
 
== Usage ==
Since TexturePacker is a command-line tool, you will need to open a dos box/terminal/console in order to run it. The general usage is:
+
Since TexturePacker is a command-line tool, you will need to open a dos box/terminal/console in order to run it. Navigate to the kodi addons folder and use:
<pre>TexturePacker -input skin.name\media -output skin.name\media\Textures.xbt</pre>
+
<pre>TexturePacker -dupecheck -input skin.name\media -output skin.name\media\Textures.xbt</pre>
  
Optionally, you can run TexturePacker with the ''-dupecheck'' option. This is useful if you have included the same image multiple times in your media folder. For example, if your skin includes a lot of studio logos, most likely a lot of them are included multiple times but with a slightly different filename. The '-dupecheck' option will make sure each unique image is included only once in the Textures.xbt file and thus keeping the size of it as small as possible.
+
The optional ''-dupecheck'' option is useful if you have included the same image multiple times in your media folder. For example, if your skin includes a lot of studio logos, most likely a lot of them are included multiple times but with a slightly different filename. The '-dupecheck' option will make sure each unique image is included only once in the Textures.xbt file, thus keeping the size of it as small as possible.
  
If your skins includes [[Skin_development_introduction#Skin_Themes]] you should also run TexturePacker on your theme folders:
+
If your skin includes [[Skin_development_introduction#Skin_Themes|Skin Themes]] you should also run TexturePacker on your theme folders:
<pre>TexturePacker -input skin.name\themes\Blue -output skin.name\media\Blue.xbt</pre>
+
<pre>TexturePacker -dupecheck -input skin.name\themes\Blue -output skin.name\media\Blue.xbt</pre>
  
 
{{Note| When using an XBT file in your skin, your file paths will '''not''' be case sensitive, even if your skin resides on a case sensitive file system!}}
 
{{Note| When using an XBT file in your skin, your file paths will '''not''' be case sensitive, even if your skin resides on a case sensitive file system!}}
  
=== Texturepacker build bat ===
+
 
 +
Alternatively, you can use the [[TextureTool|Kodi - Texture Tool]] which provides a Graphical User Interface for the same usage.
 +
 
 +
== Advanced Usage - Texturepacker build bat ==
 +
In case you want to automate the process and remove all the source images after the .xbt file has been compiled, you can optionaaly create a batch file with all needed commands.
 
Create a Texturepacker.bat with the contents below, inside the skin.name directory along with all the texturepacker.exe, a double click on the bat file does all the work for you.
 
Create a Texturepacker.bat with the contents below, inside the skin.name directory along with all the texturepacker.exe, a double click on the bat file does all the work for you.
 
<pre>
 
<pre>
@echo off
+
@ECHO OFF
ECHO ----------------------------------------
+
 
echo Creating excludes
+
COLOR A
 +
 
 +
ECHO -------------------------------------------------------------------------
 +
ECHO ^> ** Creating excludes... **
 +
 
 +
ECHO .svn>exclude.txt
 +
ECHO .git>>exclude.txt
 +
ECHO Thumbs.db>>exclude.txt
 +
ECHO Desktop.ini>>exclude.txt
 +
ECHO dsstdfx.bin>>exclude.txt
 +
ECHO build.bat>>exclude.txt
 +
ECHO \skin.confluence\media\>>exclude.txt
 +
ECHO \skin.confluence\backgrounds\>>exclude.txt
 +
ECHO exclude.txt>>exclude.txt
  
Echo .svn>exclude.txt
+
ECHO -------------------------------------------------------------------------
Echo .git>exclude.txt
+
ECHO.
Echo Thumbs.db>>exclude.txt
 
Echo Desktop.ini>>exclude.txt
 
Echo dsstdfx.bin>>exclude.txt
 
Echo build.bat>>exclude.txt
 
Echo \skin.confluence\media\>>exclude.txt
 
Echo exclude.txt>>exclude.txt
 
  
ECHO ----------------------------------------
+
ECHO -------------------------------------------------------------------------
ECHO Creating XBT File...
+
ECHO                   ** Creating Textures XBT File... **
 +
ECHO -------------------------------------------------------------------------
  
 +
ECHO.
 +
PING -n 2 -w 1000 127.0.0.1 > NUL
 
START /B /WAIT TexturePacker -dupecheck -input media\ -output media\Textures.xbt
 
START /B /WAIT TexturePacker -dupecheck -input media\ -output media\Textures.xbt
 +
PING -n 2 -w 20000 127.0.0.1 > NUL
 +
ECHO.
 +
ECHO.
 +
ECHO -------------------------------------------------------------------------
 +
ECHO ^> Deleting excludes...
 +
DEL exclude.txt
 +
ECHO ^> Done
 +
ECHO -------------------------------------------------------------------------
 +
ECHO.
 +
ECHO.
  
del exclude.txt
+
ECHO -------------------------------------------------------------------------
 +
ECHO        ** XBT build complete - scroll up to check for errors. **
 +
ECHO -------------------------------------------------------------------------
  
echo Textures.xbt build complete - Scroll Up to check for errors.
+
PING -n 50 -w 5000 127.0.0.1 > NUL
pause
 
 
</pre>
 
</pre>
  

Latest revision as of 17:45, 13 February 2019

Home icon grey.png   ▶ Development ▶ Add-on development ▶ Skinning ▶ TexturePacker

Kodi uses a tool named TexturePacker to compile all images used in a skin into a single file. The benefit of it is that images inside the Textures.xbt will load faster in the skin. This is done by converting all images into a format that take less processing by Kodi when they need to be rendered onto the screen.

A common misconception is that TexturPacker will just compress the images into a single file. This if far from the truth, so don't be surprised if the Textures.xbt file is much larger than the total size of all the individual images.

1 How To Get It

If you are using Windows, you can simply download a zipfile with an up-to-date version of TexturePacker from the Kodi mirrors.
It is available here: Download TexturePacker 1.1.1 Note: This is a dll free self contained texturepacker executable for windows. Note: Kodi v17 does not support DXT packed textures anymore. Make sure you pack your skin textures with latest texturepacker (1.1.0 or newer).

On other platforms, you will have to compile TexturePacker. TexturePacker is built and stored in ../tools/depends/native/TexturePacker/bin during Kodi's configure process. Bootstrap and configure can be lengthy. If you only need TexturePacker, you can save some effort: install the Kodi source and build dependencies in preparation for a build (Compiling from source) and build TexturePacker directly:

cd xbmc/tools/depends/native/TexturePacker
make

Note: TexturePacker depends on libgif which is currently not a Kodi dependency. Ensure the library and its development headers (Debian: libgif-dev package) is installed before compiling.

One you have downloaded/build TexturePacker, copy it to the kodi addons folder.

2 Usage

Since TexturePacker is a command-line tool, you will need to open a dos box/terminal/console in order to run it. Navigate to the kodi addons folder and use:

TexturePacker -dupecheck -input skin.name\media -output skin.name\media\Textures.xbt

The optional -dupecheck option is useful if you have included the same image multiple times in your media folder. For example, if your skin includes a lot of studio logos, most likely a lot of them are included multiple times but with a slightly different filename. The '-dupecheck' option will make sure each unique image is included only once in the Textures.xbt file, thus keeping the size of it as small as possible.

If your skin includes Skin Themes you should also run TexturePacker on your theme folders:

TexturePacker -dupecheck -input skin.name\themes\Blue -output skin.name\media\Blue.xbt

Note: When using an XBT file in your skin, your file paths will not be case sensitive, even if your skin resides on a case sensitive file system!


Alternatively, you can use the Kodi - Texture Tool which provides a Graphical User Interface for the same usage.

3 Advanced Usage - Texturepacker build bat

In case you want to automate the process and remove all the source images after the .xbt file has been compiled, you can optionaaly create a batch file with all needed commands. Create a Texturepacker.bat with the contents below, inside the skin.name directory along with all the texturepacker.exe, a double click on the bat file does all the work for you.

@ECHO OFF

COLOR A

ECHO -------------------------------------------------------------------------
ECHO ^> ** Creating excludes... **

ECHO .svn>exclude.txt
ECHO .git>>exclude.txt
ECHO Thumbs.db>>exclude.txt
ECHO Desktop.ini>>exclude.txt
ECHO dsstdfx.bin>>exclude.txt
ECHO build.bat>>exclude.txt
ECHO \skin.confluence\media\>>exclude.txt
ECHO \skin.confluence\backgrounds\>>exclude.txt
ECHO exclude.txt>>exclude.txt

ECHO -------------------------------------------------------------------------
ECHO.

ECHO -------------------------------------------------------------------------
ECHO                   ** Creating Textures XBT File... **
ECHO -------------------------------------------------------------------------

ECHO.
PING -n 2 -w 1000 127.0.0.1 > NUL
START /B /WAIT TexturePacker -dupecheck -input media\ -output media\Textures.xbt
PING -n 2 -w 20000 127.0.0.1 > NUL
ECHO.
ECHO.
ECHO -------------------------------------------------------------------------
ECHO ^> Deleting excludes...
DEL exclude.txt
ECHO ^> Done
ECHO -------------------------------------------------------------------------
ECHO.
ECHO.

ECHO -------------------------------------------------------------------------
ECHO        ** XBT build complete - scroll up to check for errors. **
ECHO -------------------------------------------------------------------------

PING -n 50 -w 5000 127.0.0.1 > NUL