Skip to main content

This package contains executables for basisu built for usage with MonoGame.

Total Downloads
20.6K
20,571
Published
Aug 22, 2024
2y ago

Get Started

dotnet add package mgcb-basisu --version 1.16.4.2

No framework information available.

README

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);

Downloads by Version

Not enough data for chart

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.