Estimate KTX2 texture memory size

Hi Forum,

I know how to calculate the required memory of a regular texture based on jpg/png images.
I would like to be able to have an estimate of the required memory of a KTX2 texture map.

I have used the tool gltf-transform etc1s to generate these ktx2 textures.

Hope anybody knows how to estimate the required size


If you’ve already loaded it in three.js as a THREE.CompressedTexture then you only need:

let byteSize = 0;
for (const mip of texture.mipmaps) {
  byteSize +=;

Note that the GPU size depends on the texture formats your GPU supports, and size may vary between devices based on that. Very old GPUs may fall back to uncompressed RGBA32, but that’s rare.

If you need to estimate memory before loading in three.js, you could use the inspect() function in glTF Transform for that, or see how I’ve computed GPU texture memory here:

Hi @donmccurdy

Thanks for the quick response,

I can confirm the GLTF loader is resolving the textures as CompressedTextures
Extracting the MB, as you mentioned, I get 2.6MB from a 2048x2048 texture. Which is awesome because uncompressed would be 21.28 MB.

Here is the snippet I executed

const byteSize = aCompressedTexture.mipmaps.reduce((byteSize, mip) => {
 return byteSize +
}, 0) ;
console.log(byteSize / 1024 / 1024); // 2.6666793823242188