KTX Tools Reference 5.0.0
Libraries and tools to create and read KTX image texture files.
Loading...
Searching...
No Matches
ktx convert

Convert another texture file type to a KTX2 file

SYNOPSIS

ktx convert [option...] input-file [output-path]

DESCRIPTION

ktx convert converts the file specified as the input-file argument to KTX v2 and saves it in the output-path. If the input-file is '-' the file will be read from the stdin. If the output-path is '-' the output file will be written to the stdout. If output-path is a directory, the output is saved to a file in that directory whose name is the stem of the value given in input-file with the extension ktx2. If no output-path is provided, the output is saved to a file whose name is the parent path and stem of the value given in input-file with the extension ktx2.

The input file must be of a supported file type. Currently the only supported type is KTX v1. Generates an error if the input file type is unrecognized.

To encode or supercompress the converted file, pipe it to ktx encode or ktx deflate via stdout.

Unrecognized metadata with keys beginning "KTX" or "ktx" found in an input KTX v1 file, is dropped and a warning is generated.

Note
When converting a KTX v1 file, payloads with format GL_COMPRESSED_RGBA_ASTC_*_KHR are mapped to the equivalent VK_FORMAT_ASTC_*_SFLOAT_BLOCK. In order to display images from the converted file, applications using Vulkan must therefore enable the VK_EXT_texture_compression_astc_hdr extension and its textureCompressionASTC_HDR feature. Using these formats, Vulkan implementations will render both HDR and LDR blocks within the images. With the alternative mapping to VK_FORMAT_ASTC_*_UNORM_BLOCK they will render HDR blocks in the error color.

OPTIONS

The following options are available:

-t, --input-type <type>
Type of input file. Currently type must be ktx. Case insensitive.
-d, --drop-bad-orientation
Some in-the-wild KTX v1 files have orientation metadata with the key "KTXOrientation" instead of KTXorientaion. By default such metadata is rewritten with the correct name. This option causes such bad metadata to be dropped. Ignored unless type is ktx.
-h, --help
Print this usage message and exit.
-v, --version
Print the version number of this program and exit.

EXIT STATUS

  • 0 - Success
  • 1 - Command line error
  • 2 - IO failure
  • 3 - Invalid input file
  • 4 - Runtime or library error
  • 5 - Not supported state or operation
  • 6 - Requested feature is not yet implemented

HISTORY

Version 4.0
  • Initial version

AUTHOR

  • Mark Callow