/img2ktx

Converts common image formats (PNG, JPG, etc.) to GPU-native compressed (BCn, ETC, ASTC) in KTX containers.

Primary LanguageC++MIT LicenseMIT

img2ktx

img2ktx is a simple command-line utility.

It currently runs on Windows, Linux and MacOS.

It loads images with stb_image. Supported formats include JPEG, PNG, BMP, TGA, GIF, etc.

It optionally generates mipmap chains with stb_image_resize.

It compresses the mipmaps to BC1, BC3, BC7, ETC1, or ASTC with Intel's ISPC Texture Compressor. It can also output uncompressed 32-bit RGBA images. Only the Windows ispc_texcomp library is included in the repo; users on other platforms must provide their own.

It writes the compressed images to a KTX file. If more than one image is provided with identical dimensions, the output KTX file can be either a 2D texture array or a cubemap.

Compile

img2ktx uses submodules for its dependencies. After cloning the repository, be sure to fetch these dependencies:

$ git submodule update --init

Then use CMake 3.15+ to generate a project file for your platform.

Binaries

Download pre-built binaries from the Releases page.

TODO

img2ktx may eventually do the following things as well (but no promises):

  • Output DDS files, because inevitably somebody is going to ask for it.
  • Convert animated GIFs directly into array textures, because what 3D graphics application isn't improved by animated GIFs?