How to create 2d texture with 1 pixel height image

if input image height is 1, pvrTexTool create ktx1 texture with height 0(1d texture), is there a option can create 2d texture which height is 1 in ktx1

Hello Qte,

Thanks for bringing up your question. I will take a closer look at it, and get back to you as soon as possible.

Hello Qte,

This is not possible. According to Khronos Group KTX specyfication here:
https://registry.khronos.org/KTX/specs/1.0/ktxspec.v1.html

For 1D textures pixelHeight and pixelDepth must be 0.

PVRTexTool automatically converts texture with height 1 to height 0, to be compatible with this format. If you open 1D texture in PVRTexTool GUI, or other programs, it will show you height of 1, hovever, in binary ktx file itself pixelHeight will be 0, as required with Khronos specyfication.

hi Tytus,

the problem is PVRTexTool automatically converts texture with height 1 to height 0,
but I want a ktx file with pixelHeight is 1,

I found something here:
https://github.khronos.org/KTX-Software/ktxtools/toktx.html
https://github.khronos.org/KTX-Software/ktxtools/toktx.html

–2d
  If the image height is 1, by default a KTX file for a 1D texture is created. With this option one for a 2D texture is created instead.

is there a option in PVRTexTool like this ?

Hi Qte,

I contacted the tools team. I will let you know if PVRTexTool have similar function, as soon as I get the information.

Are you encountering some problems with handling 1D ktx textures?

If you need a temporary fix to test some program, you can change correspoding height value to 0x01 in any binary editor:

0xAB, 0x4B, 0x54, 0x58, // first four bytes of Byte[12] identifier
0x20, 0x31, 0x31, 0xBB, // next four bytes of Byte[12] identifier
0x0D, 0x0A, 0x1A, 0x0A, // final four bytes of Byte[12] identifier
0x04, 0x03, 0x02, 0x01, // Byte[4] endianess (Big endian in this case)
0x00, 0x00, 0x00, 0x00, // UInt32 glType = 0
0x00, 0x00, 0x00, 0x01, // UInt32 glTypeSize = 1
0x00, 0x00, 0x00, 0x00, // UInt32 glFormat = 0
0x00, 0x00, 0x8D, 0x64, // UInt32 glInternalFormat = GL_ETC1_RGB8_OES
0x00, 0x00, 0x19, 0x07, // UInt32 glBaseInternalFormat = GL_RGB
0x00, 0x00, 0x00, 0x20, // UInt32 pixelWidth = 32
0x00, 0x00, 0x00, 0x20, // UInt32 pixelHeight = 32