You can easily integrate TexturePacker in your build process and run it from command line without using the graphical user interface.
Open the menu File/Install Command Line Tool
Assuming that you've installed TexturePacker in the standard location you'll have to add this path to the command line:
You can do this in your scripts using
SET "PATH=C:\Program Files\CodeAndWeb\TexturePacker\bin;%PATH%"
To add the path permanently, navigate to System Preferences -> Environment Variables in Windows.
Select the path variable and add
Use the menu TexturePacker / Install Command Line Tool to get this dialog:
Click Install. TexturePacker will ask you for admin permissions to set the link to TexturePacker. You can also install it manually using
sudo ln -s "/Applications/TexturePacker.app/Contents/MacOS/TexturePacker" "/usr/local/bin/TexturePacker"
if you don't want to install that link to TexturePacker you can also only set a path inside your build scripts or
It does not matter which way you install TexturePacker.
Nothing to do here. TexturePacker is already in the path after installing the .deb file.
To get an overview over the command line parameters simply use
This gives you a list of all available parameters with a short description. You can find a more in-depth explanation
of the parameters in the documentation here. The headlines of each section
in TextureSettings contains the
parameters. (E.g. Data format
To pack a sprite sheet — e.g. for phaser — you can use the following command line:
TexturePacker --format phaser --sheet out.png --data out.json spritefolder
--format <name>sets the output format / the game engine you use
--sheet <file>sets the file name of the sprite sheet image
--data <file>sets the file name of the data file
spritefolderis the name of the folder that contains all your sprites
TexturePacker recursively collects all sprites in the
spritefolder folder and adds them to your sprite sheet.
You can add multiple folders at once.
You can also add individual sprites if you want more control over what is added to the sheet.
TexturePacker can also process TexturePacker projects you create in the UI. Save the .tps file and call
It's also possible to process multiple sheets at the same time using
TexturePacker sheet1.tps sheet2.tps sheet3.tps ....
On macOS and Linux you can also use the following command line to process all .tps files in sequence (this is not supported on Windows)
TexturePacker can read the settings from a .tps file and override the setting from command line.
To do so set your parameters but don't add sprites or set the output file names in the graphical user interface.
Save the .tps file as
TexturePacker configuration.tps --sheet mysheet.png --data mysheet.json sprites
You can also update the .tps files with new settings from command line without opting the graphical user interface. This is useful if you want to change the same settings in many projects at once.
E.g. for updating the paddings in your project.tps:
TexturePacker project.tps --padding 10 --save project.tps
This loads the project.tps, changes the paddings and saves it again as project.tps
TexturePacker is smart about detecting file changes and when to rebuild a sprite sheet. This is done based on time stamps and a so-called smart update hash which is stored in the sprite sheet's data file.
TexturePacker re-builds a sprite sheet if
--force-publishargument is set on command line
Detecting if a rebuild is needed or not should be very fast so that you can run TexturePacker in your build scripts without a big impact on your build time.
You also don't have to set all sprites as input dependencies e.g. in make. TexturePacker does that automatically for you.