-
Notifications
You must be signed in to change notification settings - Fork 231
Home
KTX (Khronos Texture) is a lightweight file format for OpenGL® and Vulkan® textures. KTX files contain all the parameters needed for texture loading. A single file can contain anything from a simple base-level 2D texture through to a cubemap array texture with mipmaps. Texture payloads can be in Basis LZ/ETC1S or Basis UASTC formats, which can be transcoded to any GPU-supported format, in any of the block-compressed formats supported by OpenGL family and Vulkan APIs and extensions or in an uncompressed format. Basis LZ/ETC1S format is both block-compressed and supercompressed. Other formats can be supercompressed with Zstandard (zstd).
See the Khronos KTX landing page for more information about KTX and links to further information.
The original file format specification was created by Khronos’s OpenGL ES and ARB-OpenGL ES Convergence Working Groups. The Version 2.0 file format specification was created by the 3D Formats Working Group which is also responsible for glTF™️.
See the Khronos KTX Registry for more information about the specification.
The software in this repo includes libktx
, a library for reading and writing KTX files, a set of command line tools and .wasm
modules for libktx
and msc_basis_transcoder
, a Basis image transcoder, together with Javascript wrappers for them. See the repo’s README.md for details.
Downloadable binaries are available in the Releases section of this repo. Binaries of the commmand line tools and libktx
are available for GNU/Linux, macOS and windows. These packages include the resources necessary for developing applications that use libktx
. Binaries of the .wasm modules and JS wrappers are also available.
If you want to build the software yourself you will need to install CMake. See the repo’s BUILDING.md for complete instructions.
toktx
, one of the tools in this repo, can be used to create KTX and KTX 2 files using .jpg, Netpbm or .png files as input. When creating the latter it can encode to Basis LZ/ETC1S or UASTC and can supercompress with zstd. It can create any texture structure: 1D, 2D, 3D, 1D & 2D arrays, cube maps and cube map arrays.
Other software that can be used to create and edit KTX version 1 files and are expected to be updated for version 2 include:
-
The Adreno1 texture tool from Qualcomm, a GUI tool for compression and visualization of textures.
-
Mali Texture Compression Tool2 from ARM, a GUI tool that can create and view files with either compressed or uncompressed textures.Deprecated since 2022. -
PVRTexTool3 from Imagination Technology, a GUI tool that can create and view files with either compressed or uncompressed textures.
-
Compressonator, from AMD’s GPUOpen initiative, is a set of tools to allow artists and developers to more easily create compressed texture assets or model mesh optimizations and easily visualize the quality impact of various compression and rendering technologies. There is a glTF fork of Compressonator which in theory should support KTX 2 sooner but it is not receiving much love at the moment.
-
NVIDIA Texture Tools Exporter, available as a standalone GUI tool or a Photoshop Plugin. It supports loading from KTX1 and KTX2 textures and can export to KTX2.
1 Included in the Adreno SDK which can be downloaded from the Adreno GPU Tools and Resources page.
2 One of the PowerVR Tools. Download the PowerVR Tools Installer, run it and select the tools you wish to download and install.
3 Download the Mali Texture Compression Tool from the Mali Developer Center.
There are also tools that focus on viewing. These include:
-
PicoPixel which can be used for viewing KTX files & more and for debugging image handling in your applications. Windows only.
-
Image Viewer and Tonemapper which can be used for viewing, image comparisons and statistics, tonemapping and mipmap generation. This has experimental KTX 2 support. Windows only.
-
Kram can be used to encode, load, bundle, and view BC/ETC2/ASTC files as KTX/KTX2. Scripted support for KTX2 and Basis files using libktx tools. Windows/macOS with binary releases.
A JS binding for read-only libktx
is available for use with a .wasm
compilation of the library. See its documentation for details of how to use it.
There is also a JS binding for and a .wasm
module of a container-independent transcoder for images encoded in Basis Universal format so those who wish to write their own parser in JS can do so. See its documentation for details of how to use it.
The three.js library supports loading KTX2 textures or glTF files pointing at or containing them. See loader / texture / ktx2.
Babylon.js also supports loading KTX2 textures or glTF files pointing at or containing them. See KTX2 Compressed Textures in the Babylon.js docs. If you’d rather go straight to the loader code, see khronosTextureContainer2.ts.
gltfpack
can be used to update an existing glTF asset, creating textures encoded to Basis ETC1S/LZ or UASTC formats within a KTX2 container (-tc flag). Compression is performed using the basisu
executable and is thus only available in native builds.
gltf-transform
can be used to update an existing glTF asset, creating textures encoded to Basis ETC1S/LZ or UASTC formats within a KTX2 container (etc1s
or uastc
commands). Compression is performed using the KTX-Software package and is only available via commandline.
The glTF-Compressor Tool is a web based tool that lets you interactively tune texture compression size and quality, with support for KTX 2.0 texture generation to optimize performance and memory. Support for geometry compression is expected to be added in future.
See the libktx documentation for complete details of the API and examples of its use. The examples under Usage Overview on the Introduction page provide a concise summary
To report problems or suggest new functionality, please use the issues list in the GitHub repository.
Use the KTX forum of the Khronos Group Community Forums for discussion and questions.