| TEXTURECONVERTER(1) | General Commands Manual | TEXTURECONVERTER(1) |
TextureConverter —
compress, decompress, convert, compare and examine GPU
textures
TextureConverter |
[options] input ... |
TextureConverter |
--h | --help |
TextureConverter |
--version |
TextureConverter is the command-line
interface to AppleTextureConverter(3). It reads an image
or texture file, can resize it and generate mipmaps, and writes the result
in a compressed or uncompressed GPU pixel format to a texture file. This
page describes version 5.2.240000.
The --mode option selects the operation;
the default is Compress. Each operation takes one
input file, except when
--build_array,
--build_cubemap,
--build_volume or
--build_mips combine several inputs into one
texture. The inputs must load with the same pixel format, so an 8-bit and a
16-bit PNG cannot be combined. --build_cubemap takes
exactly six inputs, in +X, -X, +Y, -Y, +Z, -Z order.
Options take the form --name or
--name=value. Named values
such as modes, filters and compressors are not case-sensitive.
--ASTC_HDRSets ATC_Options.isASTCHDR.
--advanced_metricsSets ATC_Options.advancedMetrics.
--alpha_mode=valueIgnorePremultiplyPreserveDefault: ‘Ignore’.
Sets ATC_Options.alphaMode.
--alpha_reference=valueDefault: ‘0.95’.
Sets ATC_Options.alphaReference.
--alpha_to_coverageSets ATC_Options.useAlphaToCoverage.
--alpha_weightSets ATC_Options.useAlphaWeight.
--build_array--build_cubemap--build_mips--build_volume--channel_weighting=valueLinearPerceptualDefault:
‘Perceptual’.
Sets ATC_Options.channelWeighting.
--check_date--check_details--compare=value--compression_format=valueRequired in Compress mode. See
COMPRESSION FORMATS for
the formats each compressor accepts.
Default: ‘None’.
Sets ATC_Options.format.
--compression_quality=valueFastestHighestNormalProductionDefault:
‘Production’.
Sets ATC_Options.quality.
--compressor=valueAutoARMETC2COMPISPCNVTTPVRTCSTBDefault: ‘Auto’.
Sets ATC_Options.compressor.
--crop_uniform_contentSets ATC_Options.cropUniformContent.
--dds_dx10Formats the legacy DDS header cannot represent faithfully, such as the sRGB ones, are always written with the DX10 header. This option forces the DX10 header for the other formats too.
--decompressed=value--decompression_format=valueDefault: ‘Auto’.
--decompressor=valueWith --metrics or
--decompressed and an uncompressed
--compression_format, an explicit decompressor
refuses the format and the compress fails; Auto
(which selects the RAW decompressor) copies it.
Decompress and Compare
modes use an uncompressed input unchanged and ignore this option for
it.
AutoARMGPUNVTTPVRTCDefault: ‘Auto’.
--disable_annotationSets ATC_Options.disableAnnotation.
--disable_multithreadingSets ATC_Options.disableMultithreading.
--equirect_samples=valueDefault: ‘4’.
--equirect_to_cubemap--face_size=valueDefault: ‘0’.
--file_format=valueAutoDDSEXRHKTXKTX2Default: ‘Auto’.
Sets ATC_Options.fileFormat.
--flip_xSets ATC_Options.flipX.
--flip_ySets ATC_Options.flipY.
--flip_zSets ATC_Options.flipZ.
--format=valueThe target pixel format when
--compression_format is not set, for example in
Convert mode. Without it,
Convert keeps the input's format: a 16-bit PNG
converts to RGBA16, an 8-bit one to
RGBA8, and an A8 DDS stays
A8, which KTX and KTX2 cannot store, so
converting it to either fails; pass
--format=R8 to write it
as R8. Decompress ignores this option and writes
the decoded format, so an A8 DDS decompresses only to DDS; convert it
with --format=R8 to get
a KTX or KTX2 file. Accepts the uncompressed formats listed in
COMPRESSION FORMATS.
Default: ‘None’.
Sets ATC_Options.format.
--gamma_in=valueDefault: ‘1.0’.
Sets ATC_Options.gammaIn, ATC_Options.isGammaInSrgb.
--gamma_out=valueDefault: ‘1.0’.
Sets ATC_Options.gammaOut, ATC_Options.isGammaOutSrgb.
--gamut_in=valueSets ATC_Options.colorGamutIn, ATC_Options.colorGamutOut.
--gamut_out=valueSets ATC_Options.colorGamutOut.
--h--help--max_extent=valueDefault: ‘16384’.
Sets ATC_Options.maxExtent.
--max_mipmaps=valueWhen comparing, only the levels both images hold are scored,
and 0 scores all of them. With a value above 1, including the default,
two mip chains of different lengths are compared over that many levels
if both hold them; otherwise the compare fails with
‘NumMipmaps Differ’. Use 0 or 1 to
compare a single-level image with a mipped one.
Default: ‘15’.
Sets ATC_Options.maxMipmaps.
--metricsThe metrics are the fields of ATC_ErrorMetrics in AppleTextureConverter(3): Error metrics returned by ATC_Compare functions. Note: for LDR sources MSE/RMS/PSNR are reported on the [0,255] scale. For HDR sources (half-float / F32) the reference scale is the per-image absolute peak, and for RGBM encoding it is options.rgbmRange — so PSNR is content-dependent for those inputs.
SSIM, MS-SSIM, Flip and the angular-error fields are populated only when options.advancedMetrics is set (they are expensive — roughly 10x the MSE/RMS/PSNR cost; see the CLI --advanced_metrics flag); otherwise they are NaN. MS-SSIM is additionally NaN for non-LDR or <11px inputs, and the angular fields are NaN unless options.isNormalMap and the comparison has >= 3 channels.
--mipmap_filter=valueBoxCatmullRomGaussianKaiserLanczos3Lanczos5LinearMitchellTriangleDefault: ‘Kaiser’.
Sets ATC_Options.mipmapFilter.
--mode=valueCompress--compression_format and write it to
--output.Decompress--decompressed, or to
--output when
--decompressed is not given. An uncompressed
input is rewritten unchanged, so its format must
fit the output file format: an A8 DDS decompresses to DDS, not KTX or
KTX2.Compare--compare, decompressing either one first if
it is compressed, and print the error metrics.ExamineConvert--format) or file
format without compressing it. A compressed
input is rewritten to the output file format
without recompressing. This mode also builds textures from several
inputs (--build_array,
--build_cubemap,
--build_volume,
--build_mips) and cubemaps from an
equirectangular image
(--equirect_to_cubemap).Default: ‘Compress’.
--normal_mapSets ATC_Options.isNormalMap.
--output=valueRequired in Compress and
Convert modes.
--progressbar--pvrtc_punch_through=valueAllowedForcedUnusedDefault: ‘Unused’.
Sets ATC_Options.pvrtcPunchThroughMode.
--resize_filter=valueBoxCatmullRomGaussianKaiserLanczos3Lanczos5LinearMitchellTriangleDefault: ‘Mitchell’.
Sets ATC_Options.resizeFilter.
--resize_round_mode=valueNearestMultipleOfFourNearestPowerOfTwoNextMultipleOfFourNextPowerOfTwoNonePreviousMultipleOfFourPreviousPowerOfTwoDefault: ‘None’.
Sets ATC_Options.resizeRoundMode.
--rgbm_encodingSets ATC_Options.useRgbmEncoding.
--rgbm_range=valueDefault: ‘6.0’.
Sets ATC_Options.rgbmRange.
--scale_rangeSets ATC_Options.scaleRange.
--srgb_formatSets ATC_Options.useSrgbFormat.
--time--verbose--version--wrap_mode=valueDefault: ‘Mirror’.
Sets ATC_Options.wrapMode.
Compressed formats store fixed-size blocks of texels that the GPU decodes when it samples them.
For tangent-space normal maps, use normal-map mode with BC5.
The formats each compressor accepts in this build of
TextureConverter are:
ASTC10x10,
ASTC10x10_HDR, ASTC10x5,
ASTC10x5_HDR, ASTC10x6,
ASTC10x6_HDR, ASTC10x8,
ASTC10x8_HDR, ASTC12x10,
ASTC12x10_HDR, ASTC12x12,
ASTC12x12_HDR, ASTC4x4,
ASTC4x4_HDR, ASTC5x4,
ASTC5x4_HDR, ASTC5x5,
ASTC5x5_HDR, ASTC6x5,
ASTC6x5_HDR, ASTC6x6,
ASTC6x6_HDR, ASTC8x5,
ASTC8x5_HDR, ASTC8x6,
ASTC8x6_HDR, ASTC8x8,
ASTC8x8_HDR.EAC_R11,
EAC_RG11, EAC_RGBA8,
ETC2_RGB8,
ETC2_RGB8A1.ASTC4x4,
ASTC5x4, ASTC5x5,
ASTC6x5, ASTC6x6,
ASTC8x5, ASTC8x6,
ASTC8x8, BC1,
BC3, BC4,
BC5, BC6U,
BC7, ETC2_RGB8.BC1,
BC2, BC3,
BC4, BC5,
BC6S, BC6U,
BC7, EAC_R11,
EAC_RGBA8, ETC2_RGB8.PVRTC_RGBA_2BPP,
PVRTC_RGBA_4BPP,
PVRTC_RGB_2BPP,
PVRTC_RGB_4BPP. PVRTC support in Metal is now
deprecated. Usage of ASTC/ETC2/BC formats is recommended instead.BC1,
BC3, BC4,
BC5.With
--compressor=Auto,
TextureConverter selects a compressor from the
compression format, the quality level and
--normal_map, and reports its choice.
Uncompressed formats: A8,
ABGR4, B5G6R5,
BGR10A2, BGR5A1,
BGRA8, BGRX8,
R16, R32,
R8, RG16,
RG32, RG8,
RGB10A2, RGB16,
RGB32, RGB8,
RGBA16, RGBA32,
RGBA8.
Format names list the components from the lowest byte, or for the
16-bit packed formats the lowest bits, up, as Metal names its pixel formats.
B5G6R5, BGR5A1 and
ABGR4 hold the layouts of MTLPixelFormatB5G6R5Unorm
(B in bits 4:0, G in 10:5, R in 15:11), MTLPixelFormatBGR5A1Unorm (B in 4:0,
G in 9:5, R in 14:10, A in bit 15) and MTLPixelFormatABGR4Unorm (A in 3:0, B
in 7:4, G in 11:8, R in 15:12). Vulkan and Direct3D 9 name packed formats
from the high bits down, so the same layouts are
VK_FORMAT_R5G6B5_UNORM_PACK16, VK_FORMAT_A1R5G5B5_UNORM_PACK16 and
VK_FORMAT_R4G4B4A4_UNORM_PACK16. ABGR4 was called
BGRA4 before API version 5, and all three formats
then stored B in the high bits. The old name now fails with a message naming
ABGR4.
Input file formats: BMP,
DDS, EXR,
HDR, HEIC,
JPG, KTX,
KTX2, PNG,
TGA, TIFF,
WEBP.
A grayscale PNG, JPEG, TGA or PGM fills R, G and B, and a
gray+alpha PNG puts its alpha in A, so RG8, BC5 or EAC_RG11 made from one
holds the gray twice and drops the alpha. To keep a second channel in an RG
format, save the source as RGB with that channel in G. A 16-bit PNG or PSD
keeps its 16 bits. A legacy X8R8G8B8 or X8B8G8R8 DDS loads opaque, as
BGRA8 or RGBA8, whatever the
--alpha_mode, so Convert to
DDS writes A8R8G8B8 or A8B8G8R8 with alpha 255 unless
--format=BGRX8 is given.
A legacy (non-DX10) DDS in D3DFMT_A2B10G10R10 loads as RGB10A2, and one in D3DFMT_G16R16 loads as RGBA16 with B = 0 and A = 1, as there is no two-channel 16-bit unorm format to hold it. The signed bump formats (V8U8, V16U16, Q8W8V8U8, X8L8V8U8, A2W10V10U10) and any other 32-bit mask set besides A8R8G8B8, X8R8G8B8, A8B8G8R8, X8B8G8R8 and A2R10G10B10 fail with an “Unsupported DX9 ...” error, where earlier versions misread them.
The 16-bit packed formats are written and read as follows. DDS
stores B5G6R5 and BGR5A1 as
DXGI_FORMAT_B5G6R5_UNORM and DXGI_FORMAT_B5G5R5A1_UNORM (D3DFMT_R5G6B5 and
D3DFMT_A1R5G5B5 in a legacy header), which are their layouts, so the pixels
pass through. ABGR4 has no DDS format of its own and
is stored as DXGI_FORMAT_B4G4R4A4_UNORM (D3DFMT_A4R4G4B4), which has no
public Metal format, with the pixels repacked on write and back on read. KTX
labels B5G6R5 GL_RGB with GL_UNSIGNED_SHORT_5_6_5
and ABGR4 GL_RGBA with GL_UNSIGNED_SHORT_4_4_4_4;
BGR5A1 cannot be written to KTX. KTX2 labels them
VK_FORMAT_R5G6B5_UNORM_PACK16, VK_FORMAT_A1R5G5B5_UNORM_PACK16 and
VK_FORMAT_R4G4B4A4_UNORM_PACK16. On read, a KTX or KTX2 file in any
component order of the same fields, such as GL_BGR with
GL_UNSIGNED_SHORT_5_6_5, VK_FORMAT_B5G6R5_UNORM_PACK16 or
VK_FORMAT_B5G5R5A1_UNORM_PACK16, loads as the format with the same
components, repacked. A KTX file that gives GL_RGB565, GL_RGB5_A1 or
GL_RGBA4 without a matching packed type does not say where R and B are, and
fails to load.
DDS and KTX files of these formats written by earlier versions held B in the high bits under labels that say otherwise, so B5G6R5 files and BGRA4 KTX files now load with R and B swapped, and BGR5A1 and BGRA4 DDS files with their channels scrambled. KTX2 files from earlier versions were labelled VK_FORMAT_B5G6R5_UNORM_PACK16, VK_FORMAT_B5G5R5A1_UNORM_PACK16 and VK_FORMAT_B4G4R4A4_UNORM_PACK16, which matched their pixels, so they load correctly.
Output file formats: Auto,
DDS, EXR,
H, KTX,
KTX2.
With
--file_format=Auto, the
output file format follows the extension of the
--output path; an unrecognised extension writes
KTX.
Unless --disable_annotation is given, KTX
output records the TextureConverter version and the
options used, which --check_details reads back. KTX
and KTX2 output can also carry these keys:
KTX2 records the gamut in the DFD colorPrimaries field instead, and writes this key (with ATC_KeyColorTransfer where that has a value) only when the DFD cannot record the transfer function (see below). A texture with no known gamut, including every normal map, omits this key in KTX 1.1. In KTX2, normal maps and textures given atcColorGamutNone are written with KHR_DF_PRIMARIES_UNSPECIFIED, and colour textures with no gamut given keep libktx's default BT709 primaries. Reading a KTX2 whose DFD primaries and transfer give no TextureConverter color space (e.g. ACES AP0, BT.601, or Adobe RGB with a linear transfer) prints a warning, unless the options give a gamut: a conversion does not preserve them.
Omitted where the gamut implies the transfer function ('DCIP3', 'Adobe-RGB-1998', 'CIE-1931-XYZ'). KTX2 records the transfer function in the DFD transferFunction field, which may only be linear or sRGB. TextureConverter writes sRGB there for an _SRGB format, or for sRGB data in a float format, and linear otherwise. When that does not describe the data (sRGB data in any other format, PQ, HLG, ITU, and the implied transfer functions of 'DCIP3' and 'Adobe-RGB-1998'), a KTX2 also carries ATC_KeyColorGamut and, where it has a value, this key. The pair only adds what the DFD cannot state: it always agrees with the DFD's primaries and transfer. When reading a KTX2, TextureConverter uses the pair only where it agrees with the DFD, and otherwise ignores it with a warning.
TextureConverter exits 0 on success,
including for --h, --help
and --version, and 255 on failure. In
Compare mode it exits 0 only when the two images are
identical. In the texturetool compatibility
interface, -h, -? and
-l also exit 0; an unknown or ambiguous option, a
missing option argument or an unsupported -e encoder
exits 255.
To compress a source file to ASTC4x4 at highest quality with mip-maps:
TextureConverter --compression_format=ASTC4x4 --compression_quality=Highest --output=Output.ktx2 Input.png
To compress a source file to BC1 at highest quality with no mip-maps:
TextureConverter --max_mipmaps=1 --compression_format=BC1 --compression_quality=Highest --output=Output.ktx2 Input.png
To build a cube map from multiple source files:
TextureConverter --mode=convert --build_cubemap --output=Cubemap.ktx2 X_Pos.png X_Neg.png Y_Pos.png Y_Neg.png Z_Pos.png Z_Neg.png
To build a volume texture from multiple source files and compress to BC1:
TextureConverter --compression_format=BC1 --build_volume --output=Volume.ktx2 Slice1.png Slice2.png Slice3.png Slice4.png
To decompress a source file:
TextureConverter --mode=decompress --output=Output.ktx2 Input.ktx2
To compare two images:
TextureConverter --mode=compare --compare=Input2.ktx2 Input1.ktx2
When the first argument does not begin with two dashes,
TextureConverter parses the command line as the
legacy texturetool interface:
Usage: TextureConverter [-hl]
TextureConverter [-m] [-e <encoder>] -o <output> [-f <format>] <input_image>
first form:
-h Display this help menu.
-l List available encoders, individual encoder options, and file formats.
second form:
-m Generate a complete mipmap chain from the input image.
-e Encode texture levels with <encoder>.
-o Write processed image to <output>.
-f Set file <format> for <output> image.
| October 19, 2026 | macOS 26 |