mgcb-basisu 1.16.4.2

dotnet tool install --global mgcb-basisu --version 1.16.4.2                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local mgcb-basisu --version 1.16.4.2                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=mgcb-basisu&version=1.16.4.2                
nuke :add-package mgcb-basisu --version 1.16.4.2                

MonoGame.Tool.BasisUniversal

MonoGame tooling build for basis_universal

This tool can be used to compress an image into various texture compression formats. Examples are BC1-7, PVRTC, ETC1, ETC2, ASTC and ATC.

To use we must first create a "basis" file, this is an intermediate file containing the image data. From this file ALL over texture formats can be created. It is probably worth caching this "basis" file between builds.

basisu -file foo.png -ktx2

Adding a -uastc might give better results for some compression types.

Once you have the "basis" file you can then transform that into specific formats by using the -unpack command. Providing the -format_only flag will produce ONLY that format. Omitting this flag will result in ALL supported formats being produced. The values for -format_only are the numerical values for the transcoder_texture_format. For example ATC with an Alpha channel maps to cTFATC_RGBA which has a numerical value of 12.

basisu -unpack foo.ktx2 -ktx_only -linear -format_only 2

The output file(s) are listed in the output. There may be many output files. They will be stored in a .ktx files, but the internal image data will be compressed. We can use libraries like libktxsharp to read the .ktx data.

byte[] ktxBytes = File.ReadAllBytes("myImage.ktx");

KtxStructure ktxStructure = null;
using (MemoryStream ms = new MemoryStream(ktxBytes))
{
	ktxStructure = KtxLoader.LoadInput(ms);
}

Console.WriteLine(ktxStructure.header.pixelWidth);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.16.4.2 11,491 8/22/2024