### Get TexturePacker Command Line Help
Source: https://www.codeandweb.com/texturepacker/documentation/commandline
Run the TexturePacker command with the --help flag to display a list of all available parameters and their descriptions.
```bash
TexturePacker --help
```
--------------------------------
### Create TexturePacker Dockerfile
Source: https://www.codeandweb.com/texturepacker/documentation/docker-ci
Installs TexturePacker and its dependencies on Ubuntu 24.04. Ensure TexturePacker.deb is in the same directory. Uncomment the license agreement line if you agree to the terms.
```dockerfile
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt -y install \
libfontconfig \
libx11-6 \
libxkbcommon-x11-0 \
libglib2.0-0 \
libdbus-1-3 \
libgssapi-krb5-2 \
libgl1 \
libegl1 \
libegl-mesa0
# Install TexturePacker
COPY TexturePacker.deb /tmp
RUN apt -y install /tmp/TexturePacker.deb
# Uncomment this line if you agree to the license terms
# RUN echo agree | TexturePacker --version
```
--------------------------------
### Run TexturePacker via Flatpak CLI
Source: https://www.codeandweb.com/texturepacker/documentation/installation-and-licensing
Execute TexturePacker from the command line after installation via Flatpak. This command launches the application.
```bash
flatpak run com.codeandweb.texturepacker
```
--------------------------------
### Template Loop Example
Source: https://www.codeandweb.com/texturepacker/documentation/custom-exporter
Demonstrates how to iterate over a list in a template using the 'for' loop tag. Each item in 'mylist' will be rendered with a preceding hyphen and space.
```django
{% for item in mylist %}
- {{ item }}
{% endfor %}
```
--------------------------------
### Install TexturePacker on Debian/Ubuntu via CLI
Source: https://www.codeandweb.com/texturepacker/documentation/installation-and-licensing
Use this command to install the TexturePacker .deb package on Debian-based Linux distributions using the apt package manager.
```bash
sudo apt install ./TexturePacker-7.12.0.deb
```
--------------------------------
### Basic TexturePacker Template Syntax
Source: https://www.codeandweb.com/texturepacker/documentation/custom-exporter
A simple template example demonstrating comments, variable substitution, and conditional logic using 'if', 'else', and 'endif' tags. Comments are ignored during rendering.
```django
{# A simple template example #}
Hello {{ person.name }},
{% if person.hasBirthday %}
Happy Birthday!
{% else %}
Have a nice day!
{% endif %}
Bye,
{{ myname }}
```
--------------------------------
### Add Flathub Repository for Flatpak
Source: https://www.codeandweb.com/texturepacker/documentation/installation-and-licensing
If the Flatpak installation fails due to a missing runtime, add the Flathub repository. This command ensures the necessary base runtime is available.
```bash
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
```
--------------------------------
### Install TexturePacker via Flatpak
Source: https://www.codeandweb.com/texturepacker/documentation/installation-and-licensing
Install TexturePacker using the Flatpak package manager. This method is suitable for various Linux distributions.
```bash
flatpak install TexturePacker-7.12.0.flatpak
```
--------------------------------
### Install TexturePacker Command Line Tool on macOS
Source: https://www.codeandweb.com/texturepacker/documentation/commandline
Create a symbolic link to the TexturePacker executable in a directory included in your system's PATH. This allows you to run TexturePacker from the command line.
```bash
sudo ln -s "/Applications/TexturePacker.app/Contents/MacOS/TexturePacker" "/usr/local/bin/TexturePacker"
```
--------------------------------
### Update TexturePacker Project File Settings
Source: https://www.codeandweb.com/texturepacker/documentation/commandline
Modify settings within a .tps project file from the command line without opening the UI. This example updates padding settings and saves the changes back to the same file.
```bash
TexturePacker project.tps --padding 10 --save project.tps
```
--------------------------------
### Activate License via Command Line
Source: https://www.codeandweb.com/texturepacker/documentation/docker-ci
Pass the license key directly to the TexturePacker executable during each execution.
```bash
TexturePacker --activate-license TP-????-????-????-???? --sheet sheet.png --data sheet.json .....
```
--------------------------------
### Setting Up JavaScript Support in Exporters
Source: https://www.codeandweb.com/texturepacker/documentation/custom-exporter
Instructions on how to add JavaScript capabilities to a TexturePacker exporter by creating specific directories and using the .qs file extension.
```APIDOC
## Enhancing the Exporter with JavaScript
While templates are powerful, sometimes you need more advanced functionality - such as complex calculations or data transformations. In these cases, you can enhance your exporter with JavaScript.
### Setting Up JavaScript Support
To add JavaScript capabilities to your exporter:
1. Create two nested directories inside your exporter folder:
* First create a **grantlee** directory
* Then create a **0.2** directory inside it
Your folder structure should look like this:
2. Place your JavaScript file(s) in the **grantlee/0.2** directory
3. Use the **.qs** extension for your JavaScript files
```
--------------------------------
### Convert with Combined Options
Source: https://www.codeandweb.com/texturepacker/documentation/image-conversion
Applies multiple processing steps including trimming, scaling, and PVR-specific compression settings.
```bash
TexturePacker --convert-texture diffuse.png diffuse.pvr \
--pixel-format PVRTCII_2BPP --pvr-quality 5 \
--trim --scale 0.5
```
--------------------------------
### Run TexturePacker to Accept License
Source: https://www.codeandweb.com/texturepacker/documentation/docker-ci
Executes TexturePacker within the container to prompt for license agreement. This is a necessary step before using the image for packing.
```bash
docker run texturepacker:latest TexturePacker
```
--------------------------------
### Texture Configuration CLI Flags
Source: https://www.codeandweb.com/texturepacker/documentation/texture-settings
Configuration options for defining texture formats, output file paths, and optimization settings via the command line.
```APIDOC
## Texture Format Configuration
### Description
Sets the output image file format for the sprite sheet.
### Parameters
#### Query Parameters
- **--texture-format** (string) - Required - The ID of the format (e.g., png, jpg, webp, pvr3, ktx2, etc.)
---
## Texture File Path
### Description
Defines the absolute path for the generated texture file. Supports placeholders for multipack or scaling variants.
### Parameters
#### Query Parameters
- **--sheet** (string) - Required - Absolute path to the output file. Use {v} for scaling variants and {n}/{n1} for multipack indices.
---
## PNG Optimization
### Description
Configures lossless optimization effort for PNG output. Only applicable when --texture-format is set to png.
### Parameters
#### Query Parameters
- **--png-opt-level** (integer) - Optional - Value from 0 to 7. Default is 1.
---
## Image Quality Settings
### Description
Sets quality parameters for lossy texture formats.
### Parameters
#### Query Parameters
- **--jpg-quality** (integer) - Optional - 0 to 100 (default: 80)
- **--webp-quality** (integer) - Optional - 0 to 100 for lossy, >100 for lossless
- **--pvr-quality** (integer) - Optional - 0 to 7 (default: 3)
- **--etc1-quality** (integer) - Optional - 0 to 100 (default: 70)
- **--etc2-quality** (integer) - Optional - 0 to 100 (default: 70)
- **--astc-quality** (integer) - Optional - 0 to 4 (default: 2)
- **--basisu-quality** (integer) - Optional - 0 to 4 (default: 2)
- **--dxt-mode** (string) - Optional - DXT_LINEAR or DXT_PERCEPTUAL
```
--------------------------------
### Build TexturePacker Docker Image
Source: https://www.codeandweb.com/texturepacker/documentation/docker-ci
Builds the Docker image tagged as texturepacker:latest. This command should be run in the directory containing the Dockerfile.
```bash
docker build -t texturepacker:latest .
```
--------------------------------
### Process Multiple TexturePacker Projects
Source: https://www.codeandweb.com/texturepacker/documentation/commandline
Process multiple .tps project files sequentially from the command line.
```bash
TexturePacker sheet1.tps sheet2.tps sheet3.tps ....
```
--------------------------------
### Override output format via command line
Source: https://www.codeandweb.com/texturepacker/documentation/user-interface-overview
Use the command line client to publish a project with a different image format than the one defined in the .tps file.
```bash
TexturePacker main.tps --sheet ".../{n}.webp" --texture-format webp
```
--------------------------------
### Run TexturePacker with License and Mount
Source: https://www.codeandweb.com/texturepacker/documentation/docker-ci
Processes sprite sheets using TexturePacker inside the Docker container. It activates the license and uses a bind-mount to access sprite sheet directories. Replace [YOUR-LICENSE-KEY] with your actual license key.
```bash
docker run texturepacker:latest \
--mount type=bind,source=/tmp/spritesheets,target=/spritesheets \
TexturePacker --activate-license [YOUR-LICENSE-KEY] /spritesheets/*.tps
```
--------------------------------
### TexturePacker CLI Usage Syntax
Source: https://www.codeandweb.com/texturepacker/documentation/image-conversion
Basic command-line syntax for converting textures using either an explicit output filename or a format flag.
```bash
TexturePacker --convert-texture [