Skip to main content

KTX / KTX2

KTX is the Khronos texture container format for GPU textures. It is designed to store texture metadata and one or more texture images in a layout that maps cleanly onto graphics APIs.

KTX2 is the newer revision of the container. In realtime graphics workflows it is commonly used either for directly stored GPU texture payloads or as a container for Basis Universal supercompressed textures.

Why It Is Used

KTX containers are designed for texture data rather than conventional images:

  • they can store mip chains
  • they can store array, 3D, and cube texture layouts
  • they preserve GPU-oriented format metadata
  • they avoid re-encoding texture payloads at load time

KTX vs KTX2

FormatStatusNotes
KTX2Newer revisionCommon in modern realtime pipelines, including use as a container for Basis Universal payloads.
KTXOriginal revisionStill a Khronos texture container, but less flexible than KTX2 for newer workflows.

loaders.gl Support

Format Featureloaders.gl SupportNotes
KTX container parsingSupported by CompressedTextureLoader.
KTX2 container parsingSupported by CompressedTextureLoader.
KTX2 Basis transcodingUse BasisLoader when the KTX2 payload needs Basis transcoding.
Mip level extractionReturned as TextureLevel[] or TextureLevel[][] depending on loader.
GPU format taggingloaders.gl maps known container formats to WebGL and canonical texture format identifiers.