Click or drag to resize
DigitalRuneDirectXTex Texconv

Microsoft(R) DirectX 11 Texture Converter (DirectXTex version). Copyright (C) Microsoft Corp. All rights reserved.

The DirectXTex command-line tool texconv can be used prepare images for runtime use. It supports resizing, format conversion, mipmap generation, block-compression.

To create cubemaps, volume maps, or texture arrays from individual files, use Texassemble.

This topic contains the following sections:

Usage

texconv [-w <width>] [-h <height>] [-m <miplevels>] [-f <format>] [-if <filter>] [-srgb | -srgbi | -srgbo] [-px  <prefix>] [-sx <suffix>] [-o <directory>] [-ft <filetype>] [-hflip] [-vflip] [-sepalpha] [-wrap | -mirror] [-pmalpha] [-fl <featurelevel>] [-pow2] [-tu | -tf] [-dword] [-xlum] [-dx10] [-nologo] [-singleproc] [-nogpu] [-bcuniform] [-bcdither] [-bcmax] [-aw <alphaweight>] [-nmap <options>] [-nmapamp <weight>] [-timing] <files>
Arguments

The following arguments can be specified on the command-line:

Argument

Description

files

The image files that should be assembled into the DDS file.

-w width

The width of the output texture in pixels.

-h height

The height of the output texture in pixels.

-m miplevels

The number of mipmap levels to generate.

The default value is 0: By default, a full mipmap chain is generated. However, if the input image already has more than one mipmap levels, the same number will be generated for the output image.

This setting only applies to DDS output files!

-f format

The texture format of the output texture. If no format is given, the format of the first image file is used.

Allowed values are all DXGI formats (without the "DXGI_FORMAT_" prefix).

Example: -f R10G10B10A2_UNORM

-if filter

The image filter used for resizing.

Allowed values: POINT, LINEAR, CUBIC, FANT, BOX, TRIANGLE, POINT_DITHER, LINEAR_DITHER, CUBIC_DITHER, FANT_DITHER, BOX_DITHER, TRIANGLE_DITHER, POINT_DITHER_DIFFUSION, LINEAR_DITHER_DIFFUSION, CUBIC_DITHER_DIFFUSION, FANT_DITHER_DIFFUSION, BOX_DITHER_DIFFUSION, TRIANGLE_DITHER_DIFFUSION

Filters with DITHER in their name indicate that the 4x4 ordered dither algorithm, while "DITHER_DIFFUSION" is error diffusion dithering.

-srgbi, -srgbo, -srgb

Defines whether the input image (-srgbi), the output image (-srgbo) or both (-srgb) use sRGB color format (gamma 2.2).

-px prefix

The text that is attached to the front of the output file name.

-sx suffix

The text that is attached to the end of the output file name.

-o directory

The output directory.

-ft filetype

The type of the output file.

Allowed values are: BMP, JPG, JPEG, PNG, DDS, TGA, TIF, TIFF, WDP, HDP

The default value is DDS.

-hflip

Flip image horizontally.

-vflip

Flip image vertically.

-sepalpha

Resize/generate mipmap levels for alpha channel separately from color channels. This implies an alpha mode setting of DDS_ALPHA_MODE_CUSTOM as this is typically only used if the alpha channel doesn't contain transparency information.

-wrap, -mirror

Sets the texture addressing mode for filtering to WRAP or MIRROR. The default value is CLAMP.

-pmalpha

Convert final texture to premultiplied alpha. This sets an alpha mode of DDS_ALPHA_MODE_PREMULTIPLIED unless the entire alpha channel is fully opaque.

-fl featurelevel

Sets the target feature level which determines the maximum supported texture size.

Allowed values are: 9.1, 9.2, 9.3, 10.0, 10.1, 11.0, 11.1, 12.0, 12.1

The default value is "11.0" which indicates a maximum texture size of 16834.

-pow2

Fit each texture to a power-of-2 for width and height, minimizing changes to the aspect ratio.

-tf, -tu

Defines whether TYPELESS format is treated as FLOAT or UNORM.

-dword

Use DWORD instead of BYTE alignment. Only relevant for legacy DDS files.

-xlum

Expand legacy L8, L16, A8L8 and A8P8 formats to 8:8:8:8 or 16:16:16:16 format.

-dx10

Force DDS file output to always use the "DX10" header extension. The resulting file may not be compatible with the legacy D3DX10 or D3DX11 libraries.

-nologo

Suppress copyright message.

-singleproc

Disable multi-threaded compression.

-nogpu

Disable DirectCompute-based codecs.

-bcuniform

Use uniform rather than perceptual weighting for BC1-3.

-bcdither

Use dithering for BC1-3.

-bcmax

Use exchaustive compression (BC7 only).

-aw alphaweight

The BC7 GPU compressor weighting for alpha error metric.

The default value is 1.0.

-nmap options

Convert height map to normal map.

Allowed values are:

Value

Description

r

Use red channel.

g

Use green channel.

b

Use alpha channel.

l

Use luminance computed from red, green, and blue channels.

m

Use mirroring in U & V. Defaults to wrap when doing the central difference computation.

u

Use mirroring in U. Defaults to wrap when doing the central difference computation.

v

Use mirroring in V. Defaults to wrap when doing the central difference computation.

i

Invert sign of the computed normal.

o

Compute a rough occlusion term and encode it into alpha channel.

-nmapamp weight

The normal map amplitude.

The default value is 1.0.

-timing

Display elapsed processing time.

Examples

Resize an image to a power of 2 in each dimension, generate all mipmap levels and store the result as a DDS file with BC1 (DXT1) block compression:

texconv -pow2 -f BC1_UNORM cat.jpg
See Also

Other Resources