Hi. I’m trying to create a ktx file with a cube map.
I have 6 jpg images, each one is 2048x2048 pixels. Their total size is less than 5 megabytes.
I create the ktx file using toktx tool: toktx.exe --cubemap cubemap.ktx posx.jpg negx.jpg posy.jpg negy.jpg posz.jpg negz.jpg
However, I get a cubemap.ktx file that is 72 megabytes in size.
What goes wrong?
Number of pixels at 3 bytes per pixel: 2048 * 2048 * 6 * 3 = 25165824 * 3 = 75497472, so that looks like the expected size for uncompressed image data.
JPEG is of course a lossy compressed file format, so it is not surprising that the input files are smaller. You could use a compressed texture format (depends on which ones are supported by your graphics hardware) and -encode command line option for toktx.
If you switch to KTX v2.0, you can use one of the universal formats: ETC1S/BasisLZ or UASTC. These are transcodable to whatever format your hardware supports. If you choose UASTC you can use the --uastc_rdo_l and --zcmp options to reduce the size still further. --uastc_rdo_l causes a small loss in quality but improves the effect of the lossless --zcmp step. (RDO means rate-distortion optimization). You can use --zcmp on images in any format including uncompressed images. Note though that it only affects the file/transmission size. The images have to be inflated to their pre-zcmp size before uploading to a graphics API.