Image Conversion
TexturePacker's command-line client can convert single images between different texture formats using the --convert-texture mode.
Unlike the default sprite-sheet packing mode, this mode operates on one input image and re-encodes it
to a different format.
This is useful when you need to:
- Convert textures to GPU-compressed formats like ASTC, DXT, or PVRTC for mobile games
- Transcode images to Basis Universal for universal GPU compatibility
- Batch-convert assets in your build pipeline
- Resize or optimize images without creating sprite sheets
Usage
TexturePacker --convert-texture <input> [<output>] [options]
TexturePacker --convert-texture <input> --texture-format <format> [options]You can either provide an output filename (the format is derived from the extension) or specify
--texture-format explicitly. If only --texture-format is given, the output filename is derived
from the input file (same base name, new extension).
Options
With the following options, you can configure how the input texture is pre-processed and encoded.
File format and image compression
| Option | Description | Documentation |
|---|---|---|
--texture-format | Target file format (png, jpg, dds, pvr3, astc, etc.) | Texture Format |
--pixel-format | Pixel encoding (RGBA8888, DXT5, ASTC_6x6, PVRTCII_4BPP_RGBA, etc.) | Pixel Format |
--background-color <rrggbb> | Background color (hex) to replace transparency in formats without alpha channel | |
--png-opt-level | PNG compression effort (PNG only, lossless) | Png Opt Level |
--<FORMAT>-quality--dxt-mode | Format-specific compression quality settings | Image Quality |
--dither-type | Dithering algorithm (FloydSteinberg, Atkinson, NearestNeighbour, etc.) | Dithering |
Size and Scale
| Option | Description |
|---|---|
--size-constraints <mode> | Set size constraint (Supported modes) |
--force-squared | Enlarge shorter side to match longer side |
--scale <float> | Scale factor (0.01 to 10.0) |
--scale-mode <mode> | Interpolation mode for scaling (Scale modes) |
--flip-pvr | Flip PVR output vertically |
--dpi <value> | Set DPI metadata value (PNG only) |
Transparency and Trimming
| Option | Description |
|---|---|
--trim | Remove transparent edges |
--trim-margin <pixels> | Transparent border kept after trimming |
--trim-threshold <1-255> | Alpha cutoff for trimming (alpha values < threshold are treated as transparency) |
--heuristic-mask | Replace solid background color with transparency |
--alpha-handling <mode> | How to modify color values of transparent pixels (values) |
--padding <pixels> | Add transparent border around texture edges |
Examples
Basic Conversion
Convert a PNG to KTX format:
TexturePacker --convert-texture sprite.png sprite.ktxSpecifying Pixel Format
Convert to KTX with a specific ASTC block size:
TexturePacker --convert-texture sprite.png sprite.ktx --pixel-format ASTC_6x6Using Texture Format Flag
Convert to Basis Universal with high quality (output name derived automatically as sprite.basis):
TexturePacker --convert-texture sprite.png --texture-format basis --basisu-quality 3Combining Options
Convert to PVR with trimming and scaling:
TexturePacker --convert-texture diffuse.png diffuse.pvr \
--pixel-format PVRTCII_2BPP --pvr-quality 5 \
--trim --scale 0.5See Also
- Texture Compression - Overview of GPU texture compression formats
- Command line - How to use TexturePacker's command line tool