# KTX support improvements, ability to load images faster

**URL:** https://forum.castle-engine.io/t/ktx-support-improvements-ability-to-load-images-faster/2042
**Category:** News
**Created:** [October 25, 2025, 5:07pm UTC](https://forum.castle-engine.io/t/ktx-support-improvements-ability-to-load-images-faster/2042 "2025-10-25T17:07:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [October 25, 2025, 5:07pm UTC](https://forum.castle-engine.io/t/ktx-support-improvements-ability-to-load-images-faster/2042/1 "2025-10-25T17:07:23Z")

</div>

| [![Demo from Delphi Summit 2025, with shadows](https://forum.castle-engine.io/uploads/default/original/2X/f/f5fb96aa357fc9212a351460fcd973d3983d6184.png)](https://castle-engine.io/wp/wp-content/uploads/2025/07/screenshot2.png "Demo from Delphi Summit 2025, with shadows") |

Our support for the [KTX](https://castle-engine.io/ktx) image format was greatly improved, to make it the _best_ format for images (in some cases — when you don’t care about image size on disk, but care about loading time).

Note that the post below discusses various details, but you don’t really to do anything special to benefit from these improvements. Just use KTX, as any other image, for your textures / images. The [snapshot Castle Image Viewer](https://castle-engine.io/castle-image-viewer) can be also used to view KTX files.

Improvements:

1. KTX loading has been optimized for (very often) cases when the entire image contents can be loaded from disk to memory in one `Stream.ReadBuffer` call. This makes reading KTX lighting-fast in many cases.
  - To get some logs about it, you can use `CastleInternalCompositeImage` and set global `LogVerboseKtx` to `true`. We will then [send to log](https://castle-engine.io/log) additional messages when the optimal loading / saving path was used. As the name implies, this is internal functionality, if you use it: be prepared we may break it in the future (but then, this is just additional logging).

2. The support for 16-bit KTX images, which previously resulted in 8-bit data (we lost precision) and only worked for grayscale data, has been extended: they now result in float-based (32-bit) data, and support all channel variants (G, GA, RGB, RGBA).
  - 

  - Note that we also support KTX images with 32-bit float data, which load/save fast to our float-based image classes like `TGrayscaleFloatImage`. This didn’t change. We just changed 16-bit support now to also result in `TGrayscaleFloatImage`, not in `TGrayscaleImage`.

3. We can now save KTX files (without any extra libraries necessary, just pure Pascal code).

Having fun with KTX? Please [support us on Patreon](https://www.patreon.com/c/castleengine).

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [October 25, 2025, 5:21pm UTC](https://forum.castle-engine.io/t/ktx-support-improvements-ability-to-load-images-faster/2042/2 "2025-10-25T17:21:49Z")

</div>


