Skip to content

TexturePacker command line parameters

TexturePacker [options] [<sprite files>|<folders>] [<*.tps>]

You pass TexturePacker the sprites you want to pack: single image files, folders (TexturePacker adds everything inside them, including sub-folders) and .tps project files. New to TexturePacker on the command line? The command line client page shows how to install it and pack your first sheet.

When you pass a .tps file, the options you add on the command line override the settings stored in that file. That way, one project file can serve as a template for many sheets.

The following parameter documentation is grouped by what you want to do. Each group starts with the basic parameters, the ones you need for everyday packing, followed by advanced parameters for fine-tuning.

TexturePacker --help prints the options of the version you have installed.

Long examples are split over several lines with \ at the line end. That works in the macOS and Linux shells; on Windows, type the command on a single line.

Input and output files

These parameters decide which sprites go into the sheet, which files come out, and which game engine the data file is written for.

Basic

Input: list the sprites before, after or between the options, the order doesn't matter. You can mix single image files (.png, .jpg, .webp, .psd, …), folders and .tps project files. TexturePacker adds all images inside a folder, including its sub-folders, and the sprite names keep the path below that folder: sprites/hero/run_01.png becomes hero/run_01.png.

ParameterDescription
--format <name>The game engine or framework you pack for. It decides the layout of the data file and some defaults, e.g. whether sprites may be rotated. TexturePacker --help lists all formats. → details
Values: exporter names, e.g. phaser, pixijs4, unity, godot-spritesheet, cocos2d-x, spine.
--data <filename>The data file with the sprite names and positions. With --multipack, TexturePacker numbers extra files: name-0, name-1, … Formats that load several sheets from one data file, like phaser, write just one. → details
--sheet <filename>The sprite sheet image. Its extension sets the texture format, unless you pass --texture-format. With --multipack, extra sheets are numbered like the data file. → details
--texture-format <id>The image file format of the sheet. You only need it when the file extension is ambiguous. TexturePacker --help lists all formats. → details
Values: png, png8, webp, jpg, ktx, ktx2, basis, dds, pvr3ccz, …
--trim-sprite-namesRemoves the file extension (.png, .bmp, .jpg) from the sprite names written to the data file: hero/run_01 instead of hero/run_01.png. Your sprite files on disk keep their names. → details
--prepend-folder-nameAdds the name of the input folder to the sprite names in the data file: sprites/hero/run_01.png instead of hero/run_01.png when you pack the folder sprites. → details

Examples

TexturePacker --format phaser \
  --data assets/atlas.json --sheet assets/atlas.png sprites

Packs everything in the sprites folder into a Phaser atlas: assets/atlas.json and assets/atlas.png.

TexturePacker --format pixijs4 \
  --data atlas.json --sheet atlas.webp \
  --trim-sprite-names --prepend-folder-name sprites

Writes a WebP sheet for PixiJS. The texture format follows the .webp file name, and the sprites are named like sprites/hero/run_01.

TexturePacker game.tps \
  --data build/atlas.json --sheet build/atlas.png

Uses all settings and sprites from game.tps, but writes the files to the build folder.

Advanced

ParameterDescription
--ignore-files <wildcard>Leaves out all images matching the wildcard pattern (* and ?), e.g. --ignore-files "*/drafts/*". You can use it several times. Quote the pattern so your shell does not expand it.
--replace <regexp>=<string>Replaces the matching part of each sprite name with <string>, e.g. --replace "enemies/=e_" turns enemies/bat_01.png into e_bat_01.png. You can use it several times. The expression is a Perl-compatible regular expression, so escape special characters.
--texturepath <path>Adds a path in front of the texture file name that is stored in the data file. Use it when your game loads the sheet from another folder than the data file. → details
--enable-cache-bustingPhaser and PixiJS only: appends a hash (e.g. ?v=ab12cd34) to the texture file name in the data file, so browsers and CDNs load the new sheet after an update. → details
--save <filename>.tpsSaves the current settings as a .tps project file instead of packing. Combine it with a .tps file to change settings from the command line, e.g. TexturePacker project.tps --padding 4 --save project.tps.
--force-publishWrites the files even if nothing changed. By default, TexturePacker skips sheets whose sprites and settings are unchanged.
--pack-normalmapsPacks the normal maps on a separate sheet with the same layout as the sprites. By default, TexturePacker detects normal maps from their colors. → details
--normalmap-filter <string>Treats all images whose path contains the text as normal maps, e.g. normals/. Turns on --pack-normalmaps and switches off the color-based detection. → details
--normalmap-suffix <string>Finds the normal map of a sprite by this suffix, e.g. _n for hero_n.png. Turns on --pack-normalmaps and switches off the color-based detection. → details
--normalmap-sheet <filename>The file the normal map sheet is written to. Numbered like --sheet when TexturePacker writes several sheets. Turns on --pack-normalmaps. → details
Default: sheet name with suffix _n.

Exporter-specific options

Some formats write an additional file or have settings of their own. These options only work together with the matching --format. TexturePacker --help lists them for the version you have installed.

ParameterDescription
--class-file <filename>With --format spritekit-swift: Swift class file with the sprite names.
--classfile-file <filename>With --format monogame: C# class file with the sprite names.
--header-file <filename>With --format cocos2d-x or --format spritekit or --format plain: C++ / Objective-C header file.
--source-file <filename>With --format cocos2d-x: C++ source file.
--spriteids-file <filename>With --format amethyst: Rust file with the sprite IDs.
--css-media-query-2x <string>With --format css: media query for the -2x variant.
Default: a query that matches screens with 2× pixel density or 192 dpi.
--css-sprite-prefix <string>With --format css: prefix for the sprite names; works best with prefixes like icon-.
--easeljs-framerate <string>With --format easeljs: frame rate of the animations.
Default: 20.
--gamemaker-texturegroup-frame-speed <string>With --format gamemaker-texturegroup: animation speed in frames per second, written for sprites with more than one frame.
Default: 30.
--libgdx-legacy-output <bool>With --format libgdx: writes the old data file format.
--orx-includeComments <bool>With --format orx: writes comments into the data file.
--orx-optimizeSectionNames <bool>With --format orx: turns image paths into PascalCase section names.
Default: true.
--orx-pixelSnap <bool>With --format orx: snaps center pivot points to whole pixels.
--orx-keepInCache <bool>With --format orx: keeps textures and animations in the cache.
--orx-keyDuration <string>With --format orx: duration of an animation key in seconds.
Default: 0.1.
--spine-legacy-output <bool>With --format spine: writes the old data file format.
--spritestudio-writePivots <bool>With --format spritestudio: overwrites the pivots with TexturePacker's values; false keeps the pivots set in SpriteStudio.
Default: true.
--zim-framerate <string>With --format zim: frame rate of the animations.
Default: 20.
--plain-string-property <string>With --format plain: demo property of the custom exporter example, available as exporterProperties.string_property.
--plain-bool-property <bool>With --format plain: demo property of the custom exporter example, available as exporterProperties.bool_property.

Sheet layout

These parameters control how big the sheet may get, how TexturePacker places the sprites, how much space it leaves around them, how it trims them, and at which scale it packs them.

Basic

ParameterDescription
--max-size <int>
--max-width <int>
--max-height <int>
Maximum size of the sheet in pixels: --max-size sets width and height at once, --max-width and --max-height set them separately. TexturePacker makes the sheet as small as possible within this limit. → details
Default: 2048.
--multipackCreates as many sheets as needed when the sprites don't fit on one. A single sheet keeps its name, several become name-0, name-1, … Put {n} (starts at 0) or {n1} (starts at 1) into --sheet and --data to always number them. Formats like phaser write one data file for all sheets. → details
--algorithm <name>How sprites are placed. MaxRects packs tightest for rectangles, Polygon packs along the sprite outlines, Basic places sprites in rows (good for tile maps), Grid uses equal cells sized by the largest sprite. → details
Default: MaxRects (Polygon for unity-texture2d).
--padding <int>Space in pixels between the sprites and around the sheet border. Sets --shape-padding and --border-padding at once.
--extrude <int>Repeats the sprite's edge pixels outward by this many pixels. Prevents flickering gaps between tiles and sprites when your game scales or moves them by fractions of a pixel. → details
Default: depends on --format.
--trim-mode <value>Removes transparent pixels around the sprites. None keeps them, Trim keeps the original sprite size in the data file, Crop and CropKeepPos use the trimmed size, Polygon traces the sprite outline. → details
Default: depends on --format.
--scale <float>Scales all sprites before packing: 0.5 packs them at half size. → details
Default: 1.

Examples

TexturePacker --format phaser \
  --data atlas.json --sheet atlas-{n}.png \
  --max-size 1024 --multipack sprites

Splits the sprites over as many 1024×1024 sheets as needed: atlas-0.png, atlas-1.png, … Phaser loads all of them from the single data file atlas.json.

TexturePacker --format phaser \
  --data atlas.json --sheet atlas.png \
  --padding 2 --extrude 1 --trim-mode Trim sprites

Leaves 2 pixels between the sprites, repeats the edge pixels once against flickering and trims transparent borders.

TexturePacker --format phaser \
  --data atlas-half.json --sheet atlas-half.png \
  --scale 0.5 sprites

Packs a half-resolution sheet, e.g. for smaller screens.

Advanced

Size

ParameterDescription
--width <int>Fixed width of the sheet in pixels. → details
--height <int>Fixed height of the sheet in pixels. → details
--size-constraints <value>Restricts the sheet size: POT = powers of 2 (256, 512, …), MultipleOf4 = width and height divisible by 4, CompressionBlocksize = a multiple of the texture compression's block size, WordAligned = even width, AnySize = no restriction. → details
Default: depends on --format.
--force-squaredMakes the sheet square. → details

Packing

ParameterDescription
--pack-mode <mode>How hard TexturePacker tries to find the smallest sheet. Fast is quicker for large sprite sets while you work. → details
Values: Fast, Good, Best. Default: Best.
--maxrects-heuristics <mode>Placement rule for the MaxRects algorithm. Best tries all and keeps the smallest result. → details
Values: Best, ShortSideFit, LongSideFit, AreaFit, BottomLeft, ContactPoint. Default: Best.
--basic-sort-by <value>Order in which the Basic algorithm places the sprites. Best tries all and keeps the smallest result. → details
Values: Best, Name, Width, Height, Area, Circumference. Default: Best.
--basic-order <mode>Sort direction for --basic-sort-by. → details
Values: Ascending, Descending. Default: Ascending.
--align-to-grid <int>Polygon algorithm only: places the top-left corner of each untrimmed sprite at pixel coordinates divisible by this value. → details
--disable-rotation
--enable-rotation
Forbids or allows rotating sprites by 90° to pack tighter. Your engine has to support rotated sprites; the format's default takes care of that. → details
--common-divisor-x <int>Extends each sprite's width to a multiple of this many pixels, e.g. for tiles. → details
--common-divisor-y <int>Extends each sprite's height to a multiple of this many pixels. → details
--force-identical-layoutKeeps the same layout in all --variant sheets. Might need allowfraction on some variants. → details
--disable-auto-aliasPacks identical sprites separately. By default, TexturePacker packs them once and points all names at the same image. → details

Spacing and trimming

ParameterDescription
--shape-padding <int>Space in pixels between the sprites only. → details
Default: depends on --format.
--border-padding <int>Space in pixels between the sprites and the sheet border only. → details
Default: depends on --format.
--trim-threshold <int>Pixels with an alpha value below this threshold count as transparent when trimming. → details
Values: 1 to 255. Default: 1.
--trim-margin <int>Transparent margin in pixels that stays around the sprite after trimming. → details
Default: 1.
--tracer-tolerance <int>Polygon trim mode only: how far the polygon may deviate from the exact sprite outline. Lower values give more exact outlines with more vertices. → details
Default: 200.
--heuristic-maskFor sprites without transparency: removes the pixels at the sprite border that share the same color, so a single-color background becomes transparent.
--default-pivot-point <x>,<y>Pivot point written for all sprites, relative to the sprite size: 0,0 is the top-left corner, 0.5,0.5 the center.
Values: 0 to 1 each.

Scaling

ParameterDescription
--variant <expr>Adds a scaled copy of the sheet; use it several times for several resolutions. <name> replaces {v} in the file names. With <filter>, only sprites whose name or folder path matches it go into the variant. allowfraction allows non-integer sizes with --force-identical-layout. <width>:<height> sets a maximum size for this variant. → details
Values: <scale>:<name>[:<filter>[:allowfraction][:<width>:<height>]].
--scale-mode <mode>How sprites are resized. Fast uses nearest neighbor, which keeps pixel art crisp. Scale2x to Hq2x are fixed pixel-art upscalers. → details
Values: Smooth, Fast, Scale2x, Scale3x, Scale4x, Eagle, Hq2x. Default: Smooth.
TexturePacker --format phaser \
  --data atlas{v}.json --sheet atlas{v}.png \
  --variant 1:@2x --variant 0.5: sprites

Writes atlas@2x.png at full size and atlas.png at half size in one run, each with its own data file.

Image quality and compression

These parameters trade file size and memory against image quality. The pixel format decides how many bits each pixel gets, and every compressed texture format has its own quality setting.

Basic

ParameterDescription
--pixel-format <format>How the pixels are stored. Fewer bits per pixel mean smaller files and less GPU memory. The available formats depend on --texture-format; TexturePacker --help lists them all. → details
Values: e.g. RGBA8888, RGBA4444, RGB565, ETC2_RGBA, ASTC_6x6, DXT5. Default: RGBA8888.
--png-opt-level <value>PNG only, lossless: 0 always writes 32-bit PNGs, 1 writes 8-bit indexed PNGs when possible, 2 to 7 add more (and slower) optimization steps. → details
Default: 1.
--webp-quality <value>WebP only: quality of the lossy compression, from 0 (smallest) to 100 (best). Any value above 100 writes lossless WebP.
Default: lossless.
--jpg-quality <value>JPG only: from 0 (smallest) to 100 (best).
Default: 80.
--pvr-quality <value>PVRTC pixel formats only: compression quality, from 0 (fastest) to 7 (best).
Default: 3.
--astc-quality <value>ASTC pixel formats only: compression quality, from 0 (fastest) to 4 (best).
Default: 2.
--basisu-quality <value>Basis Universal (.basis, .ktx2) only: compression quality, from 0 (fastest) to 4 (best).
Default: 2.
--etc1-quality <value>ETC1 pixel formats only: compression quality, from 0 (fastest) to 100 (best).
Default: 70.
--etc2-quality <value>ETC2 pixel formats only: compression quality, from 0 (fastest) to 100 (best).
Default: 70.

The Texture Compression page explains which GPU formats your target platforms support.

Examples

TexturePacker --format phaser \
  --data atlas.json --sheet atlas.png \
  --pixel-format RGBA4444 sprites

Stores 16 bits per pixel instead of 32: half the memory, with slight color banding.

TexturePacker --format phaser \
  --data atlas.json --sheet atlas.webp \
  --webp-quality 80 sprites

Writes a lossy WebP sheet at quality 80, much smaller than a PNG.

TexturePacker --format cocos2d-x \
  --data atlas.plist --sheet atlas.ktx \
  --pixel-format ASTC_6x6 --astc-quality 3 sprites

Writes a GPU-compressed ASTC texture that stays compressed in video memory.

Advanced

ParameterDescription
--dxt-mode <value>DXT1 / DXT5 pixel formats only: how colors are weighted during compression.
Values: linear, perceptual. Default: perceptual.
--dither-type <dithertype>Dithering hides color banding in reduced pixel formats like RGBA4444. NearestNeighbour and Linear don't dither; the PngQuant types are for png8 only. → details
Values: NearestNeighbour, Linear, FloydSteinberg, FloydSteinbergAlpha, Atkinson, AtkinsonAlpha, PngQuantLow, PngQuantMedium, PngQuantHigh. Default: NearestNeighbour.
--alpha-handling <value>What happens to the color of transparent pixels. ReduceBorderArtifacts removes dark halos around sprites, PremultiplyAlpha is required by some engines, DiscardAlpha makes all pixels opaque. Pixel formats without alpha use PremultiplyAlpha. → details
Values: KeepTransparentPixels, ClearTransparentPixels, ReduceBorderArtifacts, PremultiplyAlpha, DiscardAlpha. Default: ClearTransparentPixels.
--background-color <rrggbb>Fills the sheet background with a solid color, e.g. ff0000 for red.
--flip-yFlips the texture vertically. Only works for hardware texture formats (pvr, ktx, ktx2, zktx, astc, basis, dds, pkm); needed e.g. by Phaser 4 and Unity. → details
--dpi <value>Resolution stored in the image file. Games ignore it; it matters for print and design tools.
Default: 72.
--content-protection <key>Encrypts pvr.ccz files with your 128-bit key (32 hex digits); Cocos2D only. → details

Info, logging and licensing

These parameters show information about TexturePacker, control how much it prints, and manage the license on machines without a user interface, e.g. build servers.

Basic

ParameterDescription
--helpPrints all options of the installed version, including the formats and exporter-specific options.
--activate-license <key>Activates TexturePacker with your license key. Floating licenses are deactivated automatically when TexturePacker exits. → details
--deactivate-licenseDeactivates the license on this machine, e.g. before you retire a build server.
--verbosePrints more details while packing.

Examples

TexturePacker --activate-license TP-????-????-????-????

Activates a Single User or Volume license on this machine. You only need to do this once.

A Docker/CI license works differently: TexturePacker releases it again when it exits, so pass the key with every call, or set the TP_FLOATING_LICENSE environment variable instead. See Docker & CI.

TexturePacker --activate-license TP-????-????-????-???? \
  --format phaser --data atlas.json --sheet atlas.png sprites

Packs with a Docker/CI license that is claimed for this run and released when TexturePacker exits.

TexturePacker --verbose --format phaser \
  --data atlas.json --sheet atlas.png sprites

Prints what TexturePacker does while packing, which helps when a build step fails.

Advanced

ParameterDescription
--versionPrints the TexturePacker version.
--exporter-listPrints the names of all formats you can use with --format, one per line.
--quietPrints nothing except errors.
--license-infoPrints information about the installed license.
--custom-exporters-directory <dirname>Also loads your own exporters from this folder. See Custom Exporters.
--shape-debugDraws boxes around the sprite shapes in the sheet, for debugging. See Shape outlines.

Converting single images

--convert-texture turns TexturePacker into an image converter: it converts one image file into another format, without packing a sprite sheet.

In this mode, TexturePacker accepts the options from Image quality and compression, plus --scale, --scale-mode, --texture-format, --size-constraints, --force-squared and the padding and trim options (--trim, --trim-margin, --trim-threshold, --padding, --heuristic-mask).

The Image Conversion page explains usage and options, with examples.