---
title: "Image Format Converter"
description: "Documentation: How to convert images between different texture formats using TexturePacker's command line tool."
canonical: "https://www.codeandweb.com/texturepacker/documentation/image-conversion"
product: "texturepacker"
date: "2026-01-28T00:00:00.000Z"
source: "html"
---

# 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

```bash
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](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#texture-format) |
| `--pixel-format` | Pixel encoding (RGBA8888, DXT5, ASTC\_6x6, PVRTCII\_4BPP, etc.) | [Pixel Format](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#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](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#png-opt-level) |
| `--<FORMAT>-quality`  <br>`--dxt-mode` | Format-specific compression quality settings | [Image Quality](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#image-quality) |
| `--dither-type` | Dithering algorithm (FloydSteinberg, Atkinson, NearestNeighbour, etc.) | [Dithering](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#dithering) |

### Size and Scale

| Option | Description |
| :--- | :--- |
| `--size-constraints <mode>` | Set size constraint ([Supported modes](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#size-constraints)) |
| `--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](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#scale-mode)) |
| `--flip-y` | Flip texture vertically ([hardware texture formats only](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#flip-y)) |
| `--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](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md#transparency-handling)) |
| `--padding <pixels>` | Add transparent border around texture edges |

## Examples

### Basic Conversion

Convert a PNG to KTX format:

```bash
TexturePacker --convert-texture sprite.png sprite.ktx
```

### Specifying Pixel Format

Convert to KTX with a specific ASTC block size:

```bash
TexturePacker --convert-texture sprite.png sprite.ktx --pixel-format ASTC_6x6
```

### Using Texture Format Flag

Convert to Basis Universal with high quality (output name derived automatically as `sprite.basis`):

```bash
TexturePacker --convert-texture sprite.png --texture-format basis --basisu-quality 3
```

### Combining Options

Convert to PVR with trimming and scaling:

```bash
TexturePacker --convert-texture diffuse.png diffuse.pvr \
              --pixel-format PVRTCII_2BPP --pvr-quality 5 \
              --trim --scale 0.5
```

## See Also

*   [Texture Compression](https://www.codeandweb.com/texturepacker/documentation/texture-compression.md) - Overview of GPU texture compression formats
*   [Command line](https://www.codeandweb.com/texturepacker/documentation/commandline.md) - How to use TexturePacker's command line tool

## In this section

- [Quickstart](https://www.codeandweb.com/texturepacker/documentation.md)
- [Installation & Licensing](https://www.codeandweb.com/texturepacker/documentation/installation-and-licensing.md)
- [Docker & CI](https://www.codeandweb.com/texturepacker/documentation/docker-ci.md)
- [Graphical User Interface](https://www.codeandweb.com/texturepacker/documentation/user-interface-overview.md)
- [Command line client](https://www.codeandweb.com/texturepacker/documentation/commandline.md)
- [Command line parameters](https://www.codeandweb.com/texturepacker/documentation/commandline/parameters.md)
- [Texture Settings](https://www.codeandweb.com/texturepacker/documentation/texture-settings.md)
- [Texture Compression](https://www.codeandweb.com/texturepacker/documentation/texture-compression.md)
- [Sprite Sheet Cutter](https://www.codeandweb.com/texturepacker/documentation/sprite-sheet-cutter.md)
- [Custom Exporters](https://www.codeandweb.com/texturepacker/documentation/custom-exporter.md)
- [Hidden features](https://www.codeandweb.com/texturepacker/documentation/hidden-features.md)
