KTX2 Texture Viewer and Encoder

Open a .ktx2 file to read its header, levels and key/value data and view each mip level, or turn a PNG, JPEG or WebP image into a KTX2 texture in RGBA8, BC1 or BC3 with an optional mip chain and zlib supercompression.

S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho

…

Com es fa

  1. 1
    Open

    Drop a .ktx2 file on the View tab.

  2. 2
    Inspect

    Read the format, levels and metadata.

  3. 3
    View

    Pick a mip level and save it as PNG.

  4. 4
    Encode

    Choose RGBA8, BC1 or BC3, sRGB, mips and zlib.

  5. 5
    Save

    Pick an image and download the .ktx2.

Sobre aquesta eina

The KTX2 Texture Viewer and Encoder works with KTX 2.0, the Khronos container that game engines, glTF viewers and Vulkan apps use to ship GPU textures with all their mip levels in one file. The list this tool came from asked for a KTX2 and Basis texture viewer. Basis Universal textures (ETC1S and UASTC, and .basis files) need the Basis transcoder, which is not available in this browser tool, so they are not decoded or encoded. The tool says so plainly when it meets one rather than showing a wrong picture. The View tab reads the 12-byte KTX2 identifier and the header. A KTX 1 file gets a message that only KTX 2 is read, and a .basis file a message that Basis transcoding is not available. The Header card shows the format by its Vulkan name and number, marked sRGB where it applies, the size, layers and faces, the number of mip levels, the supercompression scheme (none, BasisLZ, Zstandard or ZLIB), the colour model and transfer function from the data format descriptor, the file size and every key/value entry such as KTXwriter or KTXorientation. A table lists each level with its size and stored bytes, and the unpacked size when supercompression changes it. Pick a mip level and it is decoded to pixels and drawn, with a checkerboard behind transparent areas if you want one. The decoder handles R8, RG8, RGB8, RGBA8 and BGRA8 in UNORM and sRGB, RGBA16F and RGBA32F half and float textures, which are tone-mapped for display, and the block-compressed BC1, BC3, BC4 and BC5 formats. BC4 is shown as grey and BC5 as red and green. Levels stored with zlib supercompression are inflated first. BC7, ETC2, ASTC, Basis Universal textures and Zstandard or BasisLZ supercompression are refused with a message naming the format. Only face 0 and layer 0 are shown for cube maps and arrays.

Encoding a texture

The Encode tab takes a PNG, JPEG or WebP image and writes a KTX2 file. RGBA8 keeps the pixels as they are. BC1, also called DXT1, stores colour in 8-byte blocks of 4 × 4 pixels, 4 bits per pixel, without alpha. BC3, or DXT5, adds a separate alpha block for 8 bits per pixel. The block fit is simple and fast: each block's two end colours come from the corners of the colour bounding box and each pixel takes the nearest of four colours. That is fine for previews, tests and placeholders rather than final game assets. You can mark the data as sRGB or linear, build a full mip chain down to 1 × 1 by averaging 2 × 2 pixels, and apply zlib supercompression at level 9. The file records a KTXwriter entry, and the result is opened in the viewer at once so you can check every level.

The sample results

A 4 × 4 RGBA8 sRGB test image saved with zlib makes a 307-byte file, VkFormat 43, that decodes back to the same bytes. An 8 × 8 image, left half opaque red and right half transparent blue, gives four levels from 8 × 8 to 1 × 1. In RGBA8 the file is 644 bytes, or 371 bytes with zlib, where the 256-byte top level packs into 19 bytes. As BC1 with mips it is 312 bytes, with levels of 32, 8, 8 and 8 bytes, and the transparent blue comes back opaque because BC1 here has no alpha. As BC3 without mips it is 272 bytes with one 64-byte level, and the alpha of 255 and 0 survives.

Exports

PNG of this level saves the decoded level as a PNG image, Print sends it to the printer, and Download .ktx2 saves an encoded texture. Encoder settings can be kept as a saved project.

Who this is for

Game and 3D developers checking what an exporter wrote, technical artists comparing mip chains, and web developers preparing small textures for tests.

Limits

Basis Universal, BC7, ETC2, ASTC and Zstandard files cannot be viewed here, which rules out many textures made by toktx with Basis or Zstd options. Only the first face and layer are decoded, and 3D textures are not shown slice by slice. The BC1 and BC3 encoder is a quick fit, not a quality encoder. The output suits testing; it is not advice that a texture meets an engine's or a store's requirements, so check it with the Khronos tools.

Exemple resolt

8 × 8 half red, half transparent blue: RGBA8 with mips 644 bytes (371 with zlib), BC1 with mips 312 bytes (alpha lost), BC3 single level 272 bytes (alpha kept).

En resum

Preguntes freqüents

Can it open Basis Universal textures?

No. ETC1S and UASTC data need the Basis transcoder, which this tool does not include. A .basis file, or a KTX2 file using BasisLZ or UASTC, gets a message instead of a picture.

Which formats can it display?

R8, RG8, RGB8, RGBA8 and BGRA8 in UNORM or sRGB, RGBA16F and RGBA32F, and BC1, BC3, BC4 and BC5, with or without zlib supercompression.

Which formats can it write?

RGBA8, BC1 and BC3, each as sRGB or linear, with or without a full mip chain and zlib supercompression.

Why did my transparency disappear?

BC1 as written here has no alpha channel, so transparent pixels come back opaque. Use BC3 or RGBA8 for textures that need alpha.

How are mipmaps made?

Each level halves the width and height by averaging blocks of 2 × 2 pixels, edges clamped, down to 1 × 1. The levels are stored smallest first, as KTX2 requires.

Is anything uploaded?

No. Textures are read, decoded and encoded in this browser.

Totalment gratisSense cost, sense registre
Els fitxers es mantenen privatsTot funciona al teu navegador
Fàcil en el teu idiomaDisponible en molts idiomes