0.3.0 • Published 5 months ago
ktx2-encoder v0.3.0
ktx2-encoder
A lightweight JavaScript library for converting images to KTX2 (.ktx2) format. Powered by BinomialLLC/basis_universal.
Features
- Convert images to KTX2 format
- Support for both 2D images and cubemaps
- Integration with gltf-transform
- Support both Browser and Node.js
Quick Start
Install:
npm install --save ktx2-encoder
Import:
import { encodeToKTX2, encodeKTX2Cube } from 'ktx2-encoder';
Usage:
// encode a 2D image
encodeToKTX2(data /** ArrayBuffer of png */, options);
// encode a cube map
encodeKTX2Cube([data, ...] /** ArrayBuffer of png */, options);
See options API documentation for more details.
For gltf-transform
For the users of gltf-transform, you can use the provided function ktx
. For example:
import { ktx2 } from "ktx2-encoder/gltf-transform";
await document.transform(
ktx2({
isUASTC: true,
enableDebug: false,
generateMipmap: true,
wasmUrl: "/basis_encoder.wasm"
})
);
Note: It's recommended to host the
basis_encoder.wasm
file on your own server.
Tool
- Start server
npm run dev
Open the page,default is http://localhost:5174/
Use it! Select your images and encode it to ktx2
0.3.0
5 months ago
0.2.0
6 months ago
0.1.1
7 months ago
0.1.0
11 months ago
0.0.0-experimental.5
1 year ago
0.0.0-experimental.4
1 year ago
0.0.0-experimental.3
1 year ago
0.0.0-experimental.2
1 year ago
0.0.0-experimental.1
1 year ago
0.0.3
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.6
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago