Introduction
KTX 2 is the second version of the Khronos
Group’s texture container, built around Vulkan. The texture format is a Vulkan
VkFormat number, and a Khronos data format descriptor spells out the exact
layout of every texel, so a reader does not need a table of graphics API constants.
Each mipmap level can be supercompressed on its own: with Zstandard or zlib for any
format, or with BasisLZ for Basis Universal ETC1S data, which a loader transcodes to
whatever block-compressed format the graphics card supports. This makes KTX 2 the
texture format of the glTF extension KHR_texture_basisu. Its media type is
image/ktx2.
Structure
The file is little-endian throughout. A fixed 80-byte header and index are followed by the level index, then the data format descriptor, the key and value data, any supercompression global data, and the mipmap levels, smallest first. The reference pages cover the header and level layout, the data format descriptor, the key and value data and supercompression.
0Identifier «KTX 20»12 bytes12Header format, size, counts, supercompression scheme36 bytes48Index offsets and lengths of the descriptor, key and value data, supercompression data32 bytes80Level index offset and lengths for each mipmap level24 bytes each…Descriptor, key and value data, supercompression datavaries…Mipmap levels smallest firstvaries
Variants
- Khronos Texture 1 – OpenGL textures described by OpenGL constants, in either byte order
- Khronos Texture 2 – Vulkan textures with a data format descriptor and optional supercompression
Links
Software
- KTX-Software tools – Khronos command-line tools that create, check and convert KTX files (Windows, macOS, Linux)
- PVRTexTool – Imagination Technologies’ texture compression and viewing tool (Windows, macOS, Linux)
- Compressonator – AMD’s texture compression tool (Windows, Linux)
Developers
- libktx – Khronos library that reads and writes KTX 1 and KTX 2 (C)
- Basis Universal – encoder and transcoder for supercompressed KTX 2 (C++)
Reference
- KTX File Format Specification – the Khronos specification of KTX 2
- Khronos Data Format Specification – the descriptor that KTX 2 uses to describe texels