Specify a desired transcode format?

One issue I had when working with basis texture files was that the artist will often want a texture to be transcoded into a specific format. Normal maps work best wit BC5 compression. Most other textures look good with BC7.

Is there a way to store a hint in the KTX2 format to indicate the preferred transcode method, or whether the texture is meant to be used as a normal map? It looks like this might be what I am looking for, but it’s not a part of libktx:
https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#CompressedFormatModels

KTX has a way to store arbitrary metadata in a file via key/value pairs. The data format’s format models aren’t really meant for the kind of thing you’re talking about. Also, a KTX file doesn’t have to have DF descriptors at all.

That being said, I don’t see a mechanism in the KTX documentation for accessing the key/value pairs.

I found that toktx reports that all supercompression parameters will be stored in the meta data under " KTXwriterScParams". However, the members kvData and kvDataLen are always NULL / 0 on the saved file.

Here’s how to detect the generator settings:

bool isnormalmap = false;
unsigned int len;
std::string key = "KTXwriterScParams";
void* val;
ktxHashList_FindValue(&ktx->kvDataHead, key.c_str(), &len, &val);
String s = String((const char*)val);
if (s.Find("--normal_map") > -1) isnormalmap = true;

However, I would like something a little more reliable that hopefully will get supported by other applications. This setting only works with the ECTS compression method.