Running TexturePacker from Commandline

You can easily integrate TexturePacker in your build process and run it from command line without using the graphical user interface.

Installing the command line


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:

C:\Program Files\CodeAndWeb\TexturePacker\bin

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 C:\Program Files\CodeAndWeb\TexturePacker\bin.


Use the menu TexturePacker / Install Command Line Tool to get this dialog:

Installing TexturePacker's command line tool on macOS

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/" "/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 .zshrc or .bashrc

export PATH="/Applications/$PATH"

It does not matter which way you install TexturePacker.


Nothing to do here. TexturePacker is already in the path after installing the .deb file.

Command line arguments and help

To get an overview over the command line parameters simply use

TexturePacker --help

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 --format <name>)

Packing sprite sheets

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
  • spritefolder is 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.

Configuring TexturePacker in the UI, building from command line

TexturePacker can also process TexturePacker projects you create in the UI. Save the .tps file and call

TexturePacker sheet.tps

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 *.tps

Using a .tps file as configuration file

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 configuration.tps.

TexturePacker configuration.tps --sheet mysheet.png --data mysheet.json sprites

Updating TexturePacker project files (.tps) files from command line

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

Running TexturePacker in your build process

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

  • a sprite is changed, added or removed
  • a different version of TexturePacker is used
  • settings are changed
  • the --force-publish argument 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.