Skip to content

Repository files navigation

libktxsharp

Managed .NET 10/.NET 8 library for handling KTX File Format and KTX 2.0 file format.

Build status

Nuget

https://www.nuget.org/packages/LibKTX/

Why

Because KTX specs are public and I needed something like this for my canceled project

How to use

  1. Get nuget, build .dll or include lib folder in your project
  2. Use following code examples

KTX

usingKtxSharp;byte[]ktxBytes=File.ReadAllBytes("myImage.ktx");KtxStructurektxStructure=null;using(MemoryStreamms=newMemoryStream(ktxBytes)){ktxStructure=KtxLoader.LoadInput(ms);}Console.WriteLine(ktxStructure.header.pixelWidth);

KTX2 (standalone classes)

usingKtxSharp;byte[]ktx2Bytes=File.ReadAllBytes("myImage.ktx2");Ktx2Structurektx2Structure=null;using(MemoryStreamms=newMemoryStream(ktx2Bytes)){ktx2Structure=Ktx2Loader.LoadInput(ms);}Console.WriteLine(ktx2Structure.ktx2Header.pixelWidth);

KTX2 (view over existing memory)

usingKtxSharp;byte[]ktx2Bytes=File.ReadAllBytes("myImage.ktx2");Ktx2Viewktx2View=newKtx2View(ktx2Bytes);Console.WriteLine(ktx2View.GetPixelWidth());

How do I build this

Requirements

.NET 8 (or newer) environment

Build .dll

Move to lib folder and run

dotnet build

Build nuget

Move to lib folder and run

dotnet pack -o out --configuration Release --include-source --include-symbols

Testing

Requirements

  • nunit
  • NUnit3TestAdapter
  • Microsoft.NET.Test.Sdk

All requirements are restored when you run

dotnet restore

Run tests

Just call

dotnet test

What is in

  • Basic KTX read functionality
  • Some test cases

What is partially in

  • KTX write support

What is missing

  • More files for testing
  • Benchmarks

License

All code is released under "Do whatever you want" license aka Unlicense

About

Managed C# library for handling KTX and KTX2.0 File Formats

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages